Cleaned up game logic.