Refactored some quantization stuff

See #48, #49