Basic game logic and factoring.