reworking exception handling