Code components go at the top
When you add components to a routine they will, by default, appear in the order you create them. This is also, however, the order in which they get processed.
I recommend that when you create a code component you move it to the top of the routine unless you have a specific reason why it should be lower down.
The main reason for this is that it means the code in the Begin Routine tab is processed before any “set every repeat” parameters are set in other components.