Remove declarations from for loops to avoid errors when making for SIM