adding the debug mode option to toggle debug messages.