input refactor