Added a while loop