Added conditional debug mode.