Better validation and error handling.