Rid similar codes of ways of getting thresholds from an array