docs: private Pair<Tree,Tree> copyHelper(Tree node,Map<String,Tree> newNamesToNodes) {
      Tree clone;
      Tree newFoot = null;
      if (node.isLeaf()) {
        if (node == foot) { // found the foot node; pass it up.
          clone = node.treeFactory().newTreeNode(node.label(),new ArrayList<Tree>(0));
          newFoot = clone;
        } else {
          clone = node.treeFactory().newLeaf(node.label().labelFactory().newLabel(node.label()));
        }
      } else {
        List<Tree> newChildren = new ArrayList<Tree>(node.children().length);
        for (Tree child : node.children()) {
          Pair<Tree,Tree> newChild = copyHelper(child,newNamesToNodes);
          newChildren.add(newChild.first());
          if (newChild.second() != null) {
            if (newFoot != null) {
              System.err.println("Error -- two feet found when copying auxiliary tree " + tree.toString() + "; using last foot found.");
            }
            newFoot = newChild.second();
          }
        }
        clone = node.treeFactory().newTreeNode(node.label().labelFactory().newLabel(node.label()),newChildren);
        if (nodesToNames.containsKey(node)) {
          newNamesToNodes.put(nodesToNames.get(node),clone);
        }
      }
      return new Pair<Tree,Tree>(clone,newFoot);
    }