Drastic refactoring of exception handling.