Added TOC, moved some code to submodules.