Cleaning up the doc and automatically generating TOC