Moving game logic into library