Adding first pass at documentation, still incomplete
Reordering the remaining functions for documentation.
Clean-up of internal function order.
Tweaking documentation.