adding discontinuity detector