GZip encoding, refactoring