Version with two thresholds