Maybe abstract the gzipping process into its own method? Then this could read...

```scala
val finalData =
  if (gzipped)
    gzip(data)
  else
    data
```