added output file argument