refactored compressor, new method for compressing