construct the tree, partial work