DEBUG_ENABLED flag for debug code

There was a lot of code commented out prepended by //debug. I've
uncommented that code and made its execution dependent on the value of a
new defined constant, "DEBUG_ENABLED".