improved game logic