Factored out debug mode setting.