Add documentation to modules, cleanup.

Added documentation to most (all?) public methods of modules. Cleaned up
and fixed defoverridable and a few other minor issues.