trying to figure out how to loop a funciton