Added comments and a while loop