incremental progress

some code cleanup.  DEBUG mode.