Add several functions for tree traversal