Another thing to keep in mind is NOT to use FOR or WHILE loops if they take any appreciable time to complete - anything more than 100 microsecs or thereabouts - as they block the Arduino from doing other things until they complete.
If you need to repeat something that takes longer then just allow loop() to do the repetition and test the condition with IF
...R