Add support for gzipped files, improve logging.