adding a while loop