Refactored compression code to use base class instead