Systematic debug_flag for main loop events