Added ability to specify input file name to write