Hahaha found the bug! It should be a do-while!
Fixed bugs and refactored code for conceptual integrity.