validate_inputs function

Give error messages for invalid inputs in exported functions.