Resample earlier in thresholds code, for speed.