add treeFunction