refactor input manager