made a for loop out of the point while loop