clean up some code, added input validation and improved game flow