modified traversing-tree