add the while loop