added for and while loop