                  }
                });
                
                // Remove unused nodes
                existingNodes.forEach(node => {
                    if (!usedNodes.has(node)) {
                        cleanupNode(node, context);
                        node.remove();
                    }
                });
                
                // Execute operations to build final order
                const finalNodes = [];
                
                operations.forEach(op => {
            