moved gzip outside of loop