maxDepth for tree helper