refactoring to display input