Clean up and improve error reporting.