Lots of cleanup.  Reasonably well formatted and correctly commented.
More cosmetics.  Indentation, clearer parameter info.