Some additional documentation; WIP as I add docstrings.
Massive addition of docstrings and comments; minor code simplification.