Fixed loop structure again, so only changes to variable in loop change it