attempt at tree.c functions