Send pe_mode argument and also separate the output_filename and directory