Add more flexibility of tree traversal