Main game logic
merged pull