!link || !link.fromNode || !link.toNode) return false;
      if (link.fromNode.containingGroup !== link.toNode.containingGroup) return false;
      var cat = link.fromNode.category;
      return cat === 'EndFor' || cat === 'EndWhile' || cat === 'EndIf';
    }

    // A node dropped onto a Merge node is spliced into a link coming into that node;
    // otherwise it is spliced into a link that is coming out of that node.
    function dropOntoNode(e, oldnode) {
      if (oldnode instanceof go.Group) {
        