Added boolean function but still have to convert to while instead of if.