tree class definition