Updated Cascade Detection 5/25: Moving average for sample detection implemented