Factor gzipping into a helper method.