Refactor get_input