Add flagging for exceptions and change outputs