Header and code cleanup of debug.cpp