updated code to work with gzip and command line args