added simpler tree.c