Minor adjustment made to the way exceptions are handled in main loop