Added debug command.
Refactored some debug code into DebugConfigUtils.