model.addLinkData({ from: newnode.key, to: maybenode.key, text: 'maybe' });
        diagram.model.addLinkData({ from: maybenode.key, to: endnode.key });

        // Reconnect the existing link to the new node
        oldlink.toNode = newnode;
        // Then add a link from the end node to the old node
        diagram.model.addLinkData({ from: endnode.key, to: tonode.key });
      }
      diagram.layoutDiagram(true);
    }

    function deletingNode(node) {
      // excise node from the chain that it is in
