added another heirarchy traversal function