Added optional parameter for manually specifying file format for input and output