There's no situation in this program's need where it should have to be more than one, so just switching the whiles to ifs makes sense as a safe and simple solution.