Added code that keeps track of the used thresholds