updates to tree.c still need to merge