Abstractify thresholds code