Overhaul of error handling, Part 1
Overhaul error handling, Part 2. Done now.