Table of Contents changes, and other external links. Some re-organization of code. 

...added table of contents handling