diff --git a/TEMPLATES/HMS/PRODUCTION/hstackana_production.template b/TEMPLATES/HMS/PRODUCTION/hstackana_production.template
index 0534c29f326187f065a8c0e51b603eb773b0e759..72f32278dee24a547b93d9801b0466496faa2f89 100644
--- a/TEMPLATES/HMS/PRODUCTION/hstackana_production.template
+++ b/TEMPLATES/HMS/PRODUCTION/hstackana_production.template
@@ -43,12 +43,12 @@ Ps4_value = {ghconfig_ti_ps[3]}
 Ps5_value = {ghconfig_ti_ps[4]}
 Ps6_value = {ghconfig_ti_ps[5]}
 
-Ps1_factor = {floor(2**(ghconfig_ti_ps[0] - 1) + 1):%d}
-Ps2_factor = {floor(2**(ghconfig_ti_ps[1] - 1) + 1):%d}
-Ps3_factor = {floor(2**(ghconfig_ti_ps[2] - 1) + 1):%d}
-Ps4_factor = {floor(2**(ghconfig_ti_ps[3] - 1) + 1):%d}
-Ps5_factor = {floor(2**(ghconfig_ti_ps[4] - 1) + 1):%d}
-Ps6_factor = {floor(2**(ghconfig_ti_ps[5] - 1) + 1):%d}
+Ps1_factor = {ghconfig_ti_ps_factors[0]}
+Ps2_factor = {ghconfig_ti_ps_factors[1]}
+Ps3_factor = {ghconfig_ti_ps_factors[2]}
+Ps4_factor = {ghconfig_ti_ps_factors[3]}
+Ps5_factor = {ghconfig_ti_ps_factors[4]}
+Ps6_factor = {ghconfig_ti_ps_factors[5]}
 
 ***************
 * 3/4 Triggers
diff --git a/TEMPLATES/HMS/SCALERS/hscalers.template b/TEMPLATES/HMS/SCALERS/hscalers.template
index 84691f9732efd4a5a7ac2a490b9d533f272aa790..a429f8348fc0ee86fd1c483a7e9e4622e9628e41 100644
--- a/TEMPLATES/HMS/SCALERS/hscalers.template
+++ b/TEMPLATES/HMS/SCALERS/hscalers.template
@@ -35,12 +35,12 @@ Ps4_value = {ghconfig_ti_ps[3]}
 Ps5_value = {ghconfig_ti_ps[4]}
 Ps6_value = {ghconfig_ti_ps[5]}
 
-Ps1_factor = {floor(2**(ghconfig_ti_ps[0] - 1) + 1):%d}
-Ps2_factor = {floor(2**(ghconfig_ti_ps[1] - 1) + 1):%d}
-Ps3_factor = {floor(2**(ghconfig_ti_ps[2] - 1) + 1):%d}
-Ps4_factor = {floor(2**(ghconfig_ti_ps[3] - 1) + 1):%d}
-Ps5_factor = {floor(2**(ghconfig_ti_ps[4] - 1) + 1):%d}
-Ps6_factor = {floor(2**(ghconfig_ti_ps[5] - 1) + 1):%d}
+Ps1_factor = {ghconfig_ti_ps_factors[0]}
+Ps2_factor = {ghconfig_ti_ps_factors[1]}
+Ps3_factor = {ghconfig_ti_ps_factors[2]}
+Ps4_factor = {ghconfig_ti_ps_factors[3]}
+Ps5_factor = {ghconfig_ti_ps_factors[4]}
+Ps6_factor = {ghconfig_ti_ps_factors[5]}
 
 ***********
 * Triggers
@@ -200,4 +200,4 @@ H2X: {H.S2X.scaler} [ {H.S2X.scalerRate/1000.:%.3f} kHz ] AND between + and - si
 H2Y: {H.S2Y.scaler} [ {H.S2Y.scalerRate/1000.:%.3f} kHz ] AND between + and - sides of H2Y
 
 H1XH1Y: {H.S1XS1Y.scaler} [{H.S1XS1Y.scalerRate/1000.:%.3f}] AND between H1X and H1Y planes 
-H2XH2Y: {H.S2XS2Y.scaler} [{H.S2XS2Y.scalerRate/1000.:%.3f}] OR between H2X and H2Y planes (just for kpp, will be AND)
\ No newline at end of file
+H2XH2Y: {H.S2XS2Y.scaler} [{H.S2XS2Y.scalerRate/1000.:%.3f}] OR between H2X and H2Y planes (just for kpp, will be AND)
diff --git a/TEMPLATES/SHMS/PRODUCTION/pstackana_production.template b/TEMPLATES/SHMS/PRODUCTION/pstackana_production.template
index 0746b93a252008a0049c4bbe806c34c5d6939892..75cedccc648c1f88ce7e14ce11bb2f3e2bd4e626 100644
--- a/TEMPLATES/SHMS/PRODUCTION/pstackana_production.template
+++ b/TEMPLATES/SHMS/PRODUCTION/pstackana_production.template
@@ -32,12 +32,12 @@ Ps4_value = {gpconfig_ti_ps[3]}
 Ps5_value = {gpconfig_ti_ps[4]}
 Ps6_value = {gpconfig_ti_ps[5]}
 
-Ps1_factor = {floor(2**(gpconfig_ti_ps[0] - 1) + 1):%d}
-Ps2_factor = {floor(2**(gpconfig_ti_ps[1] - 1) + 1):%d}
-Ps3_factor = {floor(2**(gpconfig_ti_ps[2] - 1) + 1):%d}
-Ps4_factor = {floor(2**(gpconfig_ti_ps[3] - 1) + 1):%d}
-Ps5_factor = {floor(2**(gpconfig_ti_ps[4] - 1) + 1):%d}
-Ps6_factor = {floor(2**(gpconfig_ti_ps[5] - 1) + 1):%d}
+Ps1_factor = {ghconfig_ti_ps_factors[0]}
+Ps2_factor = {ghconfig_ti_ps_factors[1]}
+Ps3_factor = {ghconfig_ti_ps_factors[2]}
+Ps4_factor = {ghconfig_ti_ps_factors[3]}
+Ps5_factor = {ghconfig_ti_ps_factors[4]}
+Ps6_factor = {ghconfig_ti_ps_factors[5]}
 
 ***************	
 * 3/4 Triggers 
diff --git a/TEMPLATES/SHMS/SCALERS/pscalers.template b/TEMPLATES/SHMS/SCALERS/pscalers.template
index 4c0d0833288778d4228ca82b1a6c9180926841b0..97bf1665528628226baa5b9c79a58aa03026106a 100644
--- a/TEMPLATES/SHMS/SCALERS/pscalers.template
+++ b/TEMPLATES/SHMS/SCALERS/pscalers.template
@@ -36,12 +36,12 @@ Ps4_value = {gpconfig_ti_ps[3]}
 Ps5_value = {gpconfig_ti_ps[4]}
 Ps6_value = {gpconfig_ti_ps[5]}
 
-Ps1_factor = {floor(2**(gpconfig_ti_ps[0] - 1) + 1):%d}
-Ps2_factor = {floor(2**(gpconfig_ti_ps[1] - 1) + 1):%d}
-Ps3_factor = {floor(2**(gpconfig_ti_ps[2] - 1) + 1):%d}
-Ps4_factor = {floor(2**(gpconfig_ti_ps[3] - 1) + 1):%d}
-Ps5_factor = {floor(2**(gpconfig_ti_ps[4] - 1) + 1):%d}
-Ps6_factor = {floor(2**(gpconfig_ti_ps[5] - 1) + 1):%d}
+Ps1_factor = {ghconfig_ti_ps_factors[0]}
+Ps2_factor = {ghconfig_ti_ps_factors[1]}
+Ps3_factor = {ghconfig_ti_ps_factors[2]}
+Ps4_factor = {ghconfig_ti_ps_factors[3]}
+Ps5_factor = {ghconfig_ti_ps_factors[4]}
+Ps6_factor = {ghconfig_ti_ps_factors[5]}
 
 ***********	
 * 3/4 Triggers