implemented the iterators for the tree