Refactor user_input method