New logic for multiline traceback