Refactor gzip check