modified tree class