Finished build function for tree