updated to only show TOC if not empty