Reworked exception handling