added optional gzip compression