Pulled the hierarchy stuff out into a separate loop so it is guaranteed to be available for all pages when rendering any one page...