Refactored the game states so that invariants are encoded in the type system