diff --git a/DiffractionGratings/grating2D_scalar.pro b/DiffractionGratings/grating2D_scalar.pro
index bea6858b9d7ea86b101d304f2ed2ff4532abb4d1..9cb5b5eff650e3466f31dfa05407309a4f7efbb2 100644
--- a/DiffractionGratings/grating2D_scalar.pro
+++ b/DiffractionGratings/grating2D_scalar.pro
@@ -23,7 +23,7 @@ lambda0    = lambda0    * nm;
 lambda_min = lambda_min * nm;
 lambda_max = lambda_max * nm;
 A          = 1.;
-nb_orders  = 2;
+// nb_orders  = 2;
 
 Group {
   // Boundaries
@@ -389,8 +389,8 @@ PostProcessing {
       EndFor
       If (flag_polar==1)
         For i In {0:2*nb_orders}
-          { Name eff_r~{i} ; Value { Term{ Type Global; [ SquNorm[#i]*beta_super~{i}[]/beta1[] ] ; In SurfCutSuper1 ; } } }
-          { Name eff_t~{i} ; Value { Term{ Type Global; [ SquNorm[#(2*nb_orders+1+i)]*(beta_subs~{i}[]/beta1[])*(epsr1[]/epsr2[]) ] ; In SurfCutSubs1 ; } } }
+          { Name eff_r~{i} ; Value { Term{ Type Global; [ SquNorm[$sr~{i}]*beta_super~{i}[]/beta1[] ] ; In SurfCutSuper1 ; } } }
+          { Name eff_t~{i} ; Value { Term{ Type Global; [ SquNorm[$st~{i}]*(beta_subs~{i}[]/beta1[])*(epsr1[]/epsr2[]) ] ; In SurfCutSubs1 ; } } }
         EndFor
         For i In {0:N_rods-1:1}
           { Name Q_rod~{i}   ; Value { Integral { [  0.5 * ep0*om0*Fabs[epsr_rods_im[]]          * ( SquNorm[CompY[{Grad u2d}]*I[]/(om0*ep0*CompXX[epsilonr[]])+Ex1[]/CompXX[epsilonr[]]*CompXX[epsilonr_annex[]]] + SquNorm[-CompX[{Grad u2d}]*I[]/(om0*ep0*CompXX[epsilonr[]])+Ey1[]/CompXX[epsilonr[]]*CompXX[epsilonr_annex[]]] ) / (Pinc[]*d) ] ; In rod~{i}   ; Integration Int_1 ; Jacobian JVol ; } } }
@@ -403,8 +403,8 @@ PostProcessing {
       EndIf
       If (flag_polar==0)        
         For i In {0:2*nb_orders}
-          { Name eff_r~{i} ; Value { Term{ Type Global; [ SquNorm[#i]*beta_super~{i}[]/beta1[] ] ; In SurfCutSuper1 ; } } }
-          { Name eff_t~{i} ; Value { Term{ Type Global; [ SquNorm[#(2*nb_orders+1+i)]*(beta_subs~{i}[]/beta1[])] ; In SurfCutSubs1 ; } } }
+          { Name eff_r~{i} ; Value { Term{ Type Global; [ SquNorm[$sr~{i}]*beta_super~{i}[]/beta1[] ] ; In SurfCutSuper1 ; } } }
+          { Name eff_t~{i} ; Value { Term{ Type Global; [ SquNorm[$st~{i}]*(beta_subs~{i}[]/beta1[])] ; In SurfCutSubs1 ; } } }
         EndFor
         For i In {0:N_rods-1:1}
           { Name Q_rod~{i}  ; Value { Integral { [0.5 * ep0*om0*Fabs[epsr_rods_im[]]          * (SquNorm[{u2d}+u1[]]) / (Pinc[]*d) ] ; In rod~{i}    ; Integration Int_1 ; Jacobian JVol ; } } }
@@ -424,8 +424,8 @@ PostOperation {
     Operation {
       Print[ lambda_step, OnPoint{0,0,0}, Format Table, File > StrCat[myDir, "temp_lambda_step.txt"], SendToServer "GetDP/Lambda_step" ] ;
       For i In {0:2*nb_orders}
-        Print[ s_r~{i}[SurfCutSuper1], OnGlobal, Store i                , Format Table , File > StrCat[myDir, Sprintf("temp_s_r_%g.txt", i-nb_orders)]];
-        Print[ s_t~{i}[SurfCutSubs1] , OnGlobal, Store (2*nb_orders+1+i), Format Table , File > StrCat[myDir, Sprintf("temp_s_t_%g.txt", i-nb_orders)]];
+        Print[ s_r~{i}[SurfCutSuper1], OnGlobal, StoreInVariable $sr~{i}, Format Table , File > StrCat[myDir, Sprintf("temp_s_r_%g.txt", i-nb_orders)]];
+        Print[ s_t~{i}[SurfCutSubs1] , OnGlobal, StoreInVariable $st~{i}, Format Table , File > StrCat[myDir, Sprintf("temp_s_t_%g.txt", i-nb_orders)]];
       EndFor
       For i In {0:2*nb_orders}
         Print[ eff_r~{i}[SurfCutSuper1], OnRegion SurfCutSuper1,Store (4*nb_orders+1+i), Format FrequencyTable, File > StrCat[myDir, Sprintf("efficiency_r_%g.txt", i-nb_orders)]];