added computation of thresholds