Added data validation error handling.