add output file handling