while loop edited