Refactor game code.