Chanded do/while loop to a for loop.