Cleaned up code; added some documentation; improved some function names.  Enabled toggled display of debugging information.