made debug mode a toggle