I'm sorry, what I said was unclear: you do need to end the for loop.  You don't need to end it the next two times (this comment and my other, below)