Refactor to move the quantization