Refactor gzip routines into separate files