moved iteration variable closer to while loop