Implemented validate_input