Support both gzipped and non-gzipped input files.
Code cleanups.