gzip refactor