Updated function "check_input"