Making buildTree.