added function for command line parameters. Implemented infile and outfile