Updated tree.cpp