working toc, refactored