minor simplification in alg_quant()