refactor game