a bit more refactoring of the exception code.