diff --git a/Shocks.cc b/Shocks.cc
index 9cea0e2d8887bbde456b831307142e05b1a4512f..1216a40b463e650dc72787e0617f48baa1480563 100644
--- a/Shocks.cc
+++ b/Shocks.cc
@@ -389,19 +389,13 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
          << "constrained_paths_ = zeros(" << paths.size() << ", " << path_length << ");" << endl;
 
   int k = 1;
-
   for (AbstractShocksStatement::det_shocks_t::const_iterator it = paths.begin();
-       it != paths.end(); it++)
+       it != paths.end(); it++, k++)
     {
       if (it == paths.begin())
-        {
-          output << "constrained_vars_ = " << symbol_table.getTypeSpecificID(it->first) + 1 << ";" << endl;
-        }
+        output << "constrained_vars_ = " << symbol_table.getTypeSpecificID(it->first) + 1 << ";" << endl;
       else
-        {
-          output << "constrained_vars_ = [constrained_vars_; " << symbol_table.getTypeSpecificID(it->first) + 1 << "];" << endl;
-        }
-
+        output << "constrained_vars_ = [constrained_vars_; " << symbol_table.getTypeSpecificID(it->first) + 1 << "];" << endl;
 
       const vector<AbstractShocksStatement::DetShockElement> &elems = it->second;
       for (int i = 0; i < (int) elems.size(); i++)
@@ -411,7 +405,6 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
             elems[i].value->writeOutput(output);
             output << ";" << endl;
           }
-      k++;
     }
 }