added better quantization