public static String doMain(String[] args, int run) {
    String modelName = null;
    if (args.length == 1) {
      // test for "-h" or "--help"
      if (args[0].equals("-h") || args[0].equals("--help")) {
        printHelp();
      } else {
        System.out.println("ERROR: Wrong usage.");
        printHelp();

        // exit program
        System.exit(1);
      }
    } else {
      if ((args.length == 8) || (args[8].equals("-h"))) {

        // test for "normal" parameters
        String modelFileName = null;
        String initFilename = null;

        try {
          modelFileName = getModelFileName(args);
          SystemDynamicsCommandLine.numberRounds = getNumberRounds(args);
          exportCSV(args);
          initFilename = getExportFileName(args);
          SystemDynamicsCommandLine.exportFileName = getExportFileName(args);
          SystemDynamicsCommandLine.exportFileName =
              SystemDynamicsCommandLine.exportFileName + "_" + run;
        } catch (IllegalArgumentException e) {
          // wrong parameters -> show help
          System.out.println("ERROR: " + e.getMessage());
          printHelp();

          // exit program
          System.exit(1);
        }
        /* Modification*/
        /*@Author: Pradeep Jawahar*/
        /*Date: 04/23/2011*/
        /*Adding pre - processing step*/
        if (args.length > 8) {
          try {
            PreProcess preProcess = new PreProcess();
            HashMap<String, String> initMap = new HashMap<String, String>();
            HashMap<String, String> clist = CommandLineHelper.convertCl(args[9]);
            HashMap<String, String> preList = new HashMap<String, String>();
            int flag = 0;
            if (args[12].equals("2") && args[11].equals("0")) {
              initMap = preProcess.phase2PreProcess("phase2/" + initFilename + "_-1");
              preList.putAll(initMap);
              flag = 1;
            }

            modelName = preProcess.preprocess(modelFileName, clist, preList, run, flag);
          } catch (Exception e) {

            e.printStackTrace();
          }
        }

      } else {
        // wrong parameters -> show help
        System.out.println("ERROR: Wrong usage.");
        printHelp();

        // exit program
        System.exit(1);
      }
    }
    return modelName;
  }