Implementing game logic