diff --git a/tracy/tracy/src/nsls-ii_lib.cc b/tracy/tracy/src/nsls-ii_lib.cc
index 04020b2398915957383df9b5bd0493311d5470d8..28048d8b7e9727210ee1c0a34d55630a18780c6e 100644
--- a/tracy/tracy/src/nsls-ii_lib.cc
+++ b/tracy/tracy/src/nsls-ii_lib.cc
@@ -5,7 +5,7 @@
    T. Shaftan, I. Pinayev, Y. Luo, C. Montag, B. Nash
 
 */
-/* Current revision $Revision: 1.15 $
+/* Current revision $Revision: 1.16 $
  On branch $Name: not supported by cvs2svn $
  Latest change by $Author: zhang $
 */
@@ -3815,6 +3815,14 @@ void X_vector(const bool first)
 }
 
 
+/*
+void ini_ID_corr(void)
+
+  Purpose:
+    Initial ID, used for insertion Device correction
+
+    
+*/
 void ini_ID_corr(void)
 {
 
@@ -3883,6 +3891,63 @@ void W_diag(void)
 }
 
 
+
+
+
+
+/*
+   For ID correction, from Mao-Sen Qiu at Taiwan light source.
+*/
+
+bool ID_corr0(void)
+{
+  int     i, j, k;
+  double  b2, a2;
+  FILE    *outf;
+
+  printf("\n");
+  printf("Before correction!\n");
+
+  set_IDs(1.0);
+  //set_IDs((double) i);
+
+  get_SQ();                               // Read Betas and Nus
+  X_vector(false);                        // Fill in dX in dX=A*db2Ls_ 
+  W_diag();                               // Get statistics
+
+  outf = file_write("ID_before_corr.out");
+  fprintf(outf, "# dbeta_x/beta_x  dbeta_y/beta_y  dnu_x  dnu_y\n");
+  fprintf(outf, "#      [%%]             [%%]\n");
+  fprintf(outf, "#\n");
+  for (k = 1; k <= Nsext; k++)
+    fprintf(outf, "%6.1f %6.2f %6.2f %10.3e %10.3e\n", Ss[k-1], 1e2*Xsext[k], 1e2*Xsext[k+Nsext], Xsext[k+2*Nsext], Xsext[k+3*Nsext]);
+  fclose(outf);
+
+  // Allow for repeated calls to ID_corr, allocation is done in ini_ID_corr.
+  if (true) {
+    free_dvector(Xsext, 1, Nconstr);
+    free_dvector(Xsext0, 1, Nconstr);
+    free_dvector(b2Ls_, 1, Nquad); 
+    free_dmatrix(A1, 1, Nconstr, 1, Nquad);
+    free_dmatrix(U1, 1, Nconstr, 1, Nquad); 
+    free_dvector(w1, 1, Nquad);
+    free_dmatrix(V1, 1, Nquad, 1, Nquad);
+  }
+
+  printf("\n");
+  printf("End of before correction!\n");
+
+  return true;
+}
+
+
+/******************************************************************
+bool ID_corr(const int N_calls, const int N_steps)
+
+  Purpose:
+    Compensate the field error introduced by insertion device.
+  
+******************************************************************/
 bool ID_corr(const int N_calls, const int N_steps)
 {
   int     i, j, k;