A lot of improvements to error handling.