added out_file support