updated tree.c