partially implemented the Tree class