Addressed code cleanup #5

Introduced procedure "writeDebug" to teplace the 5-line "if (DEBUG =
true)..." construct