Added debug mode switch.