You need to insert the code before the loop.