updated tree.py