Functions Personal

Replaced if logic with a while loop to error check.