finish input refactoring