Typed exceptions
Lots of refactoring to make code less embarrassing