Altered to do-while loop, and refactored to eliminate redundancy.