 cat === 'EndIf') {
          var link = oldnode.findLinksInto().first();
          if (link) dropOntoLink(e, link);
        } else {
          var link = oldnode.findLinksOutOf().first();
          if (link) dropOntoLink(e, link);
        }
      }
    }

    // Splice a node into a link.
    // If the new node is of category "For" or "While" or "If", create a Group and splice it in,
    // and add the new node to that group, and add any other desired nodes and links to that group.
    function dropOntoLin