input validation and error handling.