added hysteresis to detection