Refactored TableOfContents for performance