Refactoring for compression