Correct while loop