Adding support for multiple thresholds.