Refactoring to game logic