Add ability to read gzip files and fix bugs