refactoring input