Loop tidy up fix, keep coding style