adding functions in tree.c