moved game logic into GameContext class