while loop changed