diff --git a/tracy/tracy/inc/lsoc.h b/tracy/tracy/inc/lsoc.h
index 82ca5cb0543c7146d0fb8effa0e84121b8dcf0f3..aa98d9ceb77a7c2c090ce496473cbbd22aaedb6d 100644
--- a/tracy/tracy/inc/lsoc.h
+++ b/tracy/tracy/inc/lsoc.h
@@ -10,11 +10,11 @@
 
 
 extern const int   nCOR;
-extern const char  hOrbitFileName[];     
-extern const char  vOrbitFileName[];    
-extern const char  OrbScanFileName[];    
+//extern const char  hOrbitFileName[];     
+//extern const char  vOrbitFileName[];    
+//extern const char  OrbScanFileName[];    
  
- extern FILE     *OrbScanFile;
+// extern FILE     *OrbScanFile;
 
 /****** for orbit correction *********/
 void prt_gcmat(int bpm, int corr, int plane);
@@ -23,21 +23,17 @@ void gcmat(int bpm, int corr, int plane);
 
 void lsoc(int niter, int bpm, int corr, int plane);
 
-/***The following functions are copied from nsls-ii_lib_templ.h, need to be tested***/
-bool CorrectCOD_Ns(FILE *hOrbitFile, FILE *vOrbitFile, const char *ae_file, const int n_orbit,
-     const int n, const int k, const int nwh, const int nwv, int *hcorrIdx, int *vcorrIdx);
-     
-void readCorrectorList(const char *hCorrListName, const char *vCorrListName, int *hcorrIdx, int *vcorrIdx);
+/***The following functions are copied from nsls-ii_lib_templ.h, need to be tested***/ void readCorrectorList(const char *hCorrListName, const char *vCorrListName, int *hcorrIdx, int *vcorrIdx);
 
 void gcmats(int bpm, int corr, int plane, int *corrIdx);
 
 void LoadFieldErrs(const char *FieldErrorFile, const bool Scale_it,
      const double Scale, const bool new_rnd, const int ik);
+         
+bool CorrectCOD_Ns(FILE *hOrbitFile, FILE *vOrbitFile, FILE *OrbitScanFile, 
+                   const char *ae_file, const int n_orbit, const int n, const int k, const int nwh, const int nwv, int *hcorrIdx, int *vcorrIdx);
      
-bool CorrectCOD_Ns(FILE *hOrbitFile, FILE *vOrbitFile, const char *ae_file, const int n_orbit,
-     const int n, const int k, const int nwh, const int nwv, int *hcorrIdx, int *vcorrIdx);
-     
-bool CorrectCODs(FILE *hOrbitFile, FILE *vOrbitFile, int n_orbit, int nwh, int nwv, int *hcorrIdx, int *vcorrIdx);
+bool CorrectCODs(FILE *hOrbitFile, FILE *vOrbitFile,FILE *OrbScanFile, int n_orbit, int nwh, int nwv, int *hcorrIdx, int *vcorrIdx);
 
 void lsoc2(int niter, int bpm, int corr, int plane, int nval);
 
diff --git a/tracy/tracy/src/lsoc.cc b/tracy/tracy/src/lsoc.cc
index 9e4bd8b24c09f372cb0935a12f69b67624f9d8fe..ac60eb1472de3a8b77bbec05b2f0545af17833c1 100644
--- a/tracy/tracy/src/lsoc.cc
+++ b/tracy/tracy/src/lsoc.cc
@@ -25,11 +25,11 @@ double  *w_lsoc[2], **A_lsoc[2],**U_lsoc[2], **V_lsoc[2];  //response matrix bet
 //global values
   /* parameters for orbit correction */
  const int   nCOR = 250; // maximum number of correctors
- const char  hOrbitFileName[]     = "horbit.out"; // LSN
- const char  vOrbitFileName[]     = "vorbit.out"; //LSN
- const char  OrbScanFileName[]    = "OrbScanFile.out";
+ //const char  hOrbitFileName[]     = "horbit.out"; // LSN
+ //const char  vOrbitFileName[]     = "vorbit.out"; //LSN
+ //const char  OrbScanFileName[]    = "OrbScanFile.out";
  
- FILE     *OrbScanFile;
+ //FILE     *OrbScanFile;
  
 
 
@@ -225,7 +225,7 @@ bool CorrectCOD_Ns(FILE *hOrbitFile, FILE *vOrbitFile, const char *ae_file, cons
        n_orbit number of iteration for orbit correction
        n number of scaling
 *******************************************************************************/
-bool CorrectCOD_Ns(FILE *hOrbitFile, FILE *vOrbitFile, const char *ae_file, const int n_orbit,
+bool CorrectCOD_Ns(FILE *hOrbitFile, FILE *vOrbitFile, FILE *OrbitScanFile,const char *ae_file, const int n_orbit,
      const int n, const int k, const int nwh, const int nwv, int *hcorrIdx, int *vcorrIdx)
 {
   bool    cod = false;
@@ -242,7 +242,7 @@ bool CorrectCOD_Ns(FILE *hOrbitFile, FILE *vOrbitFile, const char *ae_file, cons
     Align_BPM2quad(Quad);
   }
     
-  cod = CorrectCODs(hOrbitFile, vOrbitFile, n_orbit, nwh, nwv, hcorrIdx, vcorrIdx); 
+  cod = CorrectCODs(hOrbitFile, vOrbitFile,OrbitScanFile, n_orbit, nwh, nwv, hcorrIdx, vcorrIdx); 
     
   return cod;
 }
@@ -590,7 +590,7 @@ bool CorrectCODs(FILE *hOrbitFile, FILE *vOrbitFile, int n_orbit, int nwh, int n
                                  sextupole strength, to make it work in a 
 				 general way, not lattice specific. 
 ******************************************************************************************/
-bool CorrectCODs(FILE *hOrbitFile, FILE *vOrbitFile, int n_orbit, int nwh, int nwv, int *hcorrIdx, int *vcorrIdx)
+bool CorrectCODs(FILE *hOrbitFile, FILE *vOrbitFile, FILE *OrbScanFile, int n_orbit, int nwh, int nwv, int *hcorrIdx, int *vcorrIdx)
 {
   bool      cod;
   int       i,j;