Feature/tidy loop

I will be doing my work on top of this, as further work will be done within the loop, I would prefer I start with a s lightly less indented version.