Added ability to capture uncaught exceptions