diff --git a/tracy/tracy/src/read_script.cc b/tracy/tracy/src/read_script.cc
index 0adffff3fd8d8e0b1fc8be0ae673c8978ed6fff1..32e5157dd68e65d62b7f2276f3183db6bbc5cd50 100644
--- a/tracy/tracy/src/read_script.cc
+++ b/tracy/tracy/src/read_script.cc
@@ -23,7 +23,7 @@
        Read_Lattice()
 
    Comments:
-       Jianfeng Zhang 03/2011 soleil
+       Written by Jianfeng Zhang 03/2011 soleil
 
 ****************************************************************************/
 
@@ -32,14 +32,29 @@
 char twiss_file[max_str];
  // cod file
 char cod_file[max_str];
+// girder file
+char girder_file[max_str];
  //chamber file
-char chamber_file[max_str];
+
  // multipole files
 char multipole_file[max_str];
   // multipole file for soleil lattice 
 char fic_hcorr[max_str],fic_vcorr[max_str], fic_skew[max_str];
 
+//errors
+//char fe_file[max_str]; //the same as multipole_file[max_str]????
+
+/* COD correction */
+int nwh = 56, nwv = 56; //number of singular values for SVD correction
 
+//correction
+char hcorr_file[max_str], vcorr_file[max_str]; //files with the status of hcorr/vcorr status, 
+                                                  //to choose which correctors are used for orbit correction
+//default name of special elements in lattice
+char hcorr_name[max_str] = "", vcorr_name[max_str] = "";
+char skew_quad_name[max_str] = "", bpm_name[max_str] = "";
+char gs_name[max_str] = "", ge_name[max_str] = "";
+						  
 #define OLD_LATTICE
 
 /*  Read script   */
@@ -112,9 +127,7 @@ void read_script(const char *param_file_name, bool rd_lat, long& CommNo, UserCom
       //find the bool flag whose last 4 character are 'Flag' 
       if(strcmp(EndName,"Flag")==0)
            CommNo++;
-      
-      
-      
+        
       
       /*read file names................. */
       /* set file directory*/
@@ -138,45 +151,75 @@ void read_script(const char *param_file_name, bool rd_lat, long& CommNo, UserCom
 */
          #endif
         }  
-      } 
       
-      /* other file names.....*/
-      /* chamber file */
-      else if (strcmp("chamber_file", name) == 0){ 
-        sscanf(line, "%*s %s", str);
-        sprintf(chamber_file,"%s%s", in_dir, str); /* add file directory of the chamber file*/
       } 
+      
+      /* other file names.....*/ 
       else if (strcmp("multipole_file", name) == 0){ 
         sscanf(line, "%*s %s", str);
         sprintf(multipole_file,"%s%s", in_dir, str); /* add file directory of the multipole file*/
       } 
       
       /* read in bool flags */
-       //print twiss parameters flag
-      else if (strcmp("PrintTwissFlag", name) == 0){
-          sscanf(line, "%*s %s", twiss_file);
+        else if (strcmp("QuadFringeOnFlag", name) == 0){
 	  strcpy(UserCommandFlag[CommNo].CommandStr,name);
       } 
-       //print close orbit(COD) flag
-      else if (strcmp("PrintCODFlag", name) == 0){
-          sscanf(line, "%*s %s", cod_file);
+        else if (strcmp("RFvoltageFlag", name) == 0){
+	  sscanf(line, "%*s %lf", &(UserCommandFlag[CommNo].RFvolt));
 	  strcpy(UserCommandFlag[CommNo].CommandStr,name);
-      } 
+      }
+        
       //read chamber file flat
       else if (strcmp("ReadChamberFlag", name) == 0){
- 	  strcpy(UserCommandFlag[CommNo].CommandStr,name);
+ 	  sscanf(line, "%*s %s", str);
+	  sprintf(UserCommandFlag[CommNo].chamber_file,"%s%s", in_dir, str);
+	  strcpy(UserCommandFlag[CommNo].CommandStr,name);
        } 
-   
-      else if (strcmp("QuadFringeOnFlag", name) == 0){
+       //read field error, GENERIC command
+      else if (strcmp("ReadfefileFlag", name) == 0){
+ 	  sscanf(line, "%*s %s", str);
+	  sprintf(UserCommandFlag[CommNo].fe_file,"%s%s", in_dir, str);
 	  strcpy(UserCommandFlag[CommNo].CommandStr,name);
-      }
+       }     
+       //read misalignment error, then do orbit correction
+      else if (strcmp("ReadaefileFlag", name) == 0){
+          sscanf(line, "%*s %s", str);
+	  sprintf(UserCommandFlag[CommNo].ae_file,"%s%s", in_dir, str);
+	  strcpy(UserCommandFlag[CommNo].CommandStr,name);
+       } 
       
-    
-      else if (strcmp("RFvoltageFlag", name) == 0){
-	  sscanf(line, "%*s %lf", &(UserCommandFlag[CommNo].RFvolt));
+      
+      //read multipole errors; specific for SOLEIL lattice
+      else if (strcmp("ReadMultipoleFlag", name) == 0){
+            strcpy(UserCommandFlag[CommNo].CommandStr,name);
+        
+      }else if (strcmp("fic_hcorr", name) == 0){// read of h-correctors for multipoles
+        sscanf(line, "%*s %s", str);
+        sprintf(fic_hcorr,"%s%s", in_dir, str);
+      }else if (strcmp("fic_vcorr", name) == 0){// read of v-correctors for multipoles
+        sscanf(line, "%*s %s", str);
+        sprintf(fic_vcorr,"%s%s", in_dir, str);
+      }else if (strcmp("fic_skew", name) == 0){// read of skew quads for multipoles
+        sscanf(line, "%*s %s", str);
+        sprintf(fic_skew,"%s%s", in_dir, str);
+      } 
+       //print twiss parameters flag
+      else if (strcmp("PrintTwissFlag", name) == 0){
+          sscanf(line, "%*s %s", twiss_file);
 	  strcpy(UserCommandFlag[CommNo].CommandStr,name);
+      } 
+       //print close orbit(COD) flag
+      else if (strcmp("PrintCODFlag", name) == 0){
+          sscanf(line, "%*s %s", cod_file);
+	  strcpy(UserCommandFlag[CommNo].CommandStr,name);  
+      }
+      //print close orbit(COD) flag
+      else if (strcmp("PrintGirderFlag", name) == 0){
+          sscanf(line, "%*s %s", girder_file);
+	  strcpy(UserCommandFlag[CommNo].CommandStr,name);  
       }
       
+      
       else if (strcmp("TuneTracFlag", name) == 0){
 	 strcpy(UserCommandFlag[CommNo].CommandStr,name);
       }
@@ -276,23 +319,7 @@ void read_script(const char *param_file_name, bool rd_lat, long& CommNo, UserCom
         		);
         strcpy(UserCommandFlag[CommNo].CommandStr,name);   
       }
-        else if (strcmp("ReadMultipoleFlag", name) == 0){
-            strcpy(UserCommandFlag[CommNo].CommandStr,name);
-        
-      }
-    
-      else if (strcmp("fic_hcorr", name) == 0){// read of h-correctors for multipoles
-        sscanf(line, "%*s %s", str);
-        sprintf(fic_hcorr,"%s%s", in_dir, str);
-      }
-      else if (strcmp("fic_vcorr", name) == 0){// read of v-correctors for multipoles
-        sscanf(line, "%*s %s", str);
-        sprintf(fic_vcorr,"%s%s", in_dir, str);
-      }
-      else if (strcmp("fic_skew", name) == 0){// read of skew quads for multipoles
-        sscanf(line, "%*s %s", str);
-        sprintf(fic_skew,"%s%s", in_dir, str);
-      } 
+   
 //       generic one, fit for 1 family of quadrupoles
       else if (strcmp("FitTuneFlag", name) == 0){
         sscanf(line, "%*s %s %s %lf %lf",UserCommandFlag[CommNo].qf,UserCommandFlag[CommNo].qd,
@@ -369,8 +396,52 @@ void read_script(const char *param_file_name, bool rd_lat, long& CommNo, UserCom
        else if (strcmp("TousTrackFlag", name) == 0){
         strcpy(UserCommandFlag[CommNo].CommandStr,name); 
       }
-      
-      else {
+  
+      //correctors for COD correction
+       else if (strcmp("hcorr_file", name) == 0){ 
+        sscanf(line, "%*s %s", str);
+        sprintf(hcorr_file,"%s%s", in_dir, str); /* add file directory of the multipole file*/
+      }
+       else if (strcmp("vcorr_file", name) == 0){ 
+        sscanf(line, "%*s %s", str);
+        sprintf(vcorr_file,"%s%s", in_dir, str); /* add file directory of the multipole file*/
+      }
+        else if (strcmp("bpm_name", name) == 0){ 
+        sscanf(line, "%*s %s", bpm_name); /* the name of bpm */
+      }
+      else if (strcmp("h_corr", name) == 0){ 
+        sscanf(line, "%*s %s", hcorr_name); /* the name of H corrector used for COD correction*/
+      }
+      else if (strcmp("v_corr", name) == 0){ 
+        sscanf(line, "%*s %s", vcorr_name); /* the name of V corrector used for COD correction*/
+      }
+      else if (strcmp("qt", name) == 0){ 
+        sscanf(line, "%*s %s", skew_quad_name); /* name of skew quadrupoles */
+      }
+      else if (strcmp("gs", name) == 0){ 
+        sscanf(line, "%*s %s", gs_name); /* name of start of the girder */
+      }
+      else if (strcmp("ge", name) == 0){ 
+        sscanf(line, "%*s %s", ge_name); /* name of end of the girder */
+      }
+       
+      //set parameters for COD correction  
+      else if (strcmp("n_orbit", name) == 0){
+        sscanf(line, "%*s %d", &n_orbit);
+      }
+      else if (strcmp("n_scale", name) == 0){
+        sscanf(line, "%*s %d", &n_scale);
+      }
+      else if (strcmp("n_stat", name) == 0){
+        sscanf(line, "%*s %d", &n_stat);
+      }
+      else if (strcmp("nwh", name) == 0){
+        sscanf(line, "%*s %d", &nwh);
+      }
+      else if (strcmp("nwv", name) == 0){
+        sscanf(line, "%*s %d", &nwv);
+      }
+      else{
         printf("bad line in file %s, line %ld \n", full_param_file_name, LineNum);
         exit_(1);
       }