cleaned up a loop