separating out game logic