Reworked exception handling a little bit