refactor input