refactored game to be more modular