implemented some methods for working with tree