Comments added.  Debug code marked with DEBUG tag and commented out in some cases.