added while loop
added while loop