added option to specify output file name