refactoring game logic to include multiple game states