Rewriting quantizer, fixing resize error.