refactor game input