added code for setting output file