Improved documentation.

Blocks of code catagorized / commented better.