Make the logic inside cycle_warning more precise