Added while loop and for loop