toc_determine_hierarchy function

Determine level in hierarchy