Moved debug messages to be conditionally included.