Reworking some of the exception handling.