refactored to persits game state changes