While loop fixed