refactoring on input box