Better input validation and error messaging.