seperate the function quantize