Addressed code cleanup #5

Introduced procedure "writeDebug" to teplace the 5-line "if (DEBUG =
true)..." construct
Merge pull request #8 from McCavity/code-cleanup-#5

Addressed code cleanup #5