diff --git a/CodeInterpreter.hh b/CodeInterpreter.hh
index 43577a49810d755d42f8d055e4cc628d0c40dcff..3c2f6e00a2feef000c52a6bbe1d18d934b3dfde3 100644
--- a/CodeInterpreter.hh
+++ b/CodeInterpreter.hh
@@ -229,15 +229,15 @@ enum TrinaryOpcode
   };
 
 enum external_function_type
-{
-  ExternalFunctionWithoutDerivative,
-  ExternalFunctionWithFirstDerivative,
-  ExternalFunctionWithFirstandSecondDerivative,
-  ExternalFunctionNumericalFirstDerivative,
-  ExternalFunctionFirstDerivative,
-  ExternalFunctionNumericalSecondDerivative,
-  ExternalFunctionSecondDerivative
-};
+  {
+    ExternalFunctionWithoutDerivative,
+    ExternalFunctionWithFirstDerivative,
+    ExternalFunctionWithFirstandSecondDerivative,
+    ExternalFunctionNumericalFirstDerivative,
+    ExternalFunctionFirstDerivative,
+    ExternalFunctionNumericalSecondDerivative,
+    ExternalFunctionSecondDerivative
+  };
 
 enum PriorDistributions
   {
@@ -1452,9 +1452,9 @@ public:
     exogenous = vector<unsigned int>(exogenous_arg);
     other_endogenous = vector<unsigned int>(other_endogenous_arg);
     is_linear = is_linear_arg; endo_nbr = endo_nbr_arg; Max_Lag = Max_Lag_arg; Max_Lead = Max_Lead_arg; u_count_int = u_count_int_arg;
-    nb_col_jacob = nb_col_jacob_arg; 
-    det_exo_size = det_exo_size_arg; nb_col_det_exo_jacob = nb_col_det_exo_jacob_arg; 
-    exo_size = exo_size_arg; nb_col_exo_jacob = nb_col_exo_jacob_arg; 
+    nb_col_jacob = nb_col_jacob_arg;
+    det_exo_size = det_exo_size_arg; nb_col_det_exo_jacob = nb_col_det_exo_jacob_arg;
+    exo_size = exo_size_arg; nb_col_exo_jacob = nb_col_exo_jacob_arg;
     other_endo_size = other_endo_size_arg; nb_col_other_endo_jacob = nb_col_other_endo_jacob_arg;
   };
   inline
@@ -1468,7 +1468,7 @@ public:
     is_linear = is_linear_arg; endo_nbr = endo_nbr_arg; Max_Lag = Max_Lag_arg; Max_Lead = Max_Lead_arg; u_count_int = u_count_int_arg;
     nb_col_jacob = nb_col_jacob_arg;
     det_exo_size = 0; exo_size = 0; other_endo_size = 0;
-    nb_col_det_exo_jacob = 0;nb_col_exo_jacob = 0;nb_col_other_endo_jacob = 0;
+    nb_col_det_exo_jacob = 0; nb_col_exo_jacob = 0; nb_col_other_endo_jacob = 0;
   }
   inline unsigned int
   get_size()
@@ -2026,4 +2026,3 @@ public:
 #endif
 #pragma pack(pop)
 #endif
-
diff --git a/ComputingTasks.cc b/ComputingTasks.cc
index 6ab9e27c82edf0e8f7d7cf40b18c96d57c76ba9e..287da9cafd97b8c96aed2c1ae66c1f159ce5bde8 100644
--- a/ComputingTasks.cc
+++ b/ComputingTasks.cc
@@ -150,11 +150,11 @@ PriorPosteriorFunctionStatement::checkPass(ModFileStructure &mod_file_struct, Wa
 {
   OptionsList::string_options_t::const_iterator it2 = options_list.string_options.find("function");
   if (it2 == options_list.string_options.end() || it2->second.empty())
-      {
-          cerr << "ERROR: both the prior_function and posterior_function commands require the 'function' argument"
-               << endl;
-          exit(EXIT_FAILURE);
-      }
+    {
+      cerr << "ERROR: both the prior_function and posterior_function commands require the 'function' argument"
+           << endl;
+      exit(EXIT_FAILURE);
+    }
 }
 
 void
@@ -163,7 +163,7 @@ PriorPosteriorFunctionStatement::writeOutput(ostream &output, const string &base
   options_list.writeOutput(output);
   string type = "posterior";
   if (prior_func)
-      type = "prior";
+    type = "prior";
 
   output << "oo_ = execute_prior_posterior_function("
          << "'" << options_list.string_options.find("function")->second << "', "
@@ -266,7 +266,7 @@ VarRestrictionsStatement::VarRestrictionsStatement(const string &var_model_name_
                                                    const crossequation_restrictions_t &crossequation_restrictions_arg,
                                                    const map<pair<int, int>, double> &covariance_number_restriction_arg,
                                                    const map<pair<int, int>, pair<int, int> > &covariance_pair_restriction_arg,
-                                                   const SymbolTable &symbol_table_arg ) :
+                                                   const SymbolTable &symbol_table_arg) :
   var_model_name(var_model_name_arg),
   var_map(var_map_arg),
   exclusion_restrictions(exclusion_restrictions_arg),
@@ -312,7 +312,7 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
     }
   vector<string> vars = itvs->second;
 
-  string Mstr ("M_.var." + var_model_name + ".restrictions.");
+  string Mstr("M_.var." + var_model_name + ".restrictions.");
   int nrestrictions = 0;
 
   // Exclusion Restrictions
@@ -465,14 +465,14 @@ StochSimulStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
   it = options_list.num_options.find("hp_filter");
   OptionsList::num_options_t::const_iterator it1 = options_list.num_options.find("bandpass.indicator");
   OptionsList::num_options_t::const_iterator it2 = options_list.num_options.find("one_sided_hp_filter");
-  if ((it != options_list.num_options.end() && it1 != options_list.num_options.end()) ||
-      (it != options_list.num_options.end() && it2 != options_list.num_options.end()) ||
-      (it1 != options_list.num_options.end() && it2 != options_list.num_options.end()))
-      {
-          cerr << "ERROR: stoch_simul: can only use one of hp, one-sided hp, and bandpass filters"
-               << endl;
-          exit(EXIT_FAILURE);
-      }
+  if ((it != options_list.num_options.end() && it1 != options_list.num_options.end())
+      || (it != options_list.num_options.end() && it2 != options_list.num_options.end())
+      || (it1 != options_list.num_options.end() && it2 != options_list.num_options.end()))
+    {
+      cerr << "ERROR: stoch_simul: can only use one of hp, one-sided hp, and bandpass filters"
+           << endl;
+      exit(EXIT_FAILURE);
+    }
 }
 
 void
@@ -506,7 +506,7 @@ ForecastStatement::writeOutput(ostream &output, const string &basename, bool min
 }
 
 RamseyModelStatement::RamseyModelStatement(const SymbolList &symbol_list_arg,
-                                             const OptionsList &options_list_arg) :
+                                           const OptionsList &options_list_arg) :
   symbol_list(symbol_list_arg),
   options_list(options_list_arg)
 {
@@ -570,7 +570,7 @@ RamseyConstraintsStatement::RamseyConstraintsStatement(const constraints_t &cons
 void
 RamseyConstraintsStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
 {
-  if ((mod_file_struct.ramsey_model_present != true) || (  mod_file_struct.ramsey_policy_present != true))
+  if ((mod_file_struct.ramsey_model_present != true) || (mod_file_struct.ramsey_policy_present != true))
     cerr << "ramsey_constraints: can only be used with ramsey_model or ramsey_policy" << endl;
 }
 
@@ -581,26 +581,26 @@ RamseyConstraintsStatement::writeOutput(ostream &output, const string &basename,
   for (RamseyConstraintsStatement::constraints_t::const_iterator it = constraints.begin(); it != constraints.end(); ++it)
     {
       if (it != constraints.begin())
-	output << ", ";
+        output << ", ";
       output << "{" << it->endo + 1 << ", '";
-      switch(it->code)
-	{
-	case oLess:
-	  output << '<';
-	  break;
-	case oGreater:
-	  output << '>';
-	  break;
-	case oLessEqual:
-	  output << "<=";
-	  break;
-	case oGreaterEqual:
-	  output << ">=";
-	  break;
-	default:
-	  cerr << "Ramsey constraints: this shouldn't happen." << endl;
-	  exit(EXIT_FAILURE);
-	}
+      switch (it->code)
+        {
+        case oLess:
+          output << '<';
+          break;
+        case oGreater:
+          output << '>';
+          break;
+        case oLessEqual:
+          output << "<=";
+          break;
+        case oGreaterEqual:
+          output << ">=";
+          break;
+        default:
+          cerr << "Ramsey constraints: this shouldn't happen." << endl;
+          exit(EXIT_FAILURE);
+        }
       output << "', '";
       it->expression->writeOutput(output);
       output << "'}" << endl;
@@ -679,7 +679,7 @@ RamseyPolicyStatement::checkPass(ModFileStructure &mod_file_struct, WarningConso
 {
   // ramsey_model_present indicates that the model is augmented with the FOC of the planner problem
   mod_file_struct.ramsey_model_present = true;
-  // ramsey_policy_present indicates that ramsey_policy instruction for computation of first order approximation 
+  // ramsey_policy_present indicates that ramsey_policy instruction for computation of first order approximation
   // of  a stochastic Ramsey problem if present in the *.mod file
   mod_file_struct.ramsey_policy_present = true;
 
@@ -753,7 +753,7 @@ RamseyPolicyStatement::writeOutput(ostream &output, const string &basename, bool
 }
 
 DiscretionaryPolicyStatement::DiscretionaryPolicyStatement(const SymbolList &symbol_list_arg,
-							   const OptionsList &options_list_arg) :
+                                                           const OptionsList &options_list_arg) :
   symbol_list(symbol_list_arg),
   options_list(options_list_arg)
 {
@@ -829,16 +829,16 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
   if (it != options_list.num_options.end())
     {
       int order = atoi(it->second.c_str());
-          
+
       if (order > 2)
         {
           cerr << "ERROR: order > 2 is not supported in estimation" << endl;
           exit(EXIT_FAILURE);
         }
-      
+
       mod_file_struct.order_option = max(mod_file_struct.order_option, order);
     }
-  
+
   // Fill in mod_file_struct.partial_information
   it = options_list.num_options.find("partial_information");
   if (it != options_list.num_options.end() && it->second == "1")
@@ -851,8 +851,8 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
 
   it = options_list.num_options.find("dsge_var");
   if (it != options_list.num_options.end())
-      // Fill in mod_file_struct.dsge_var_calibrated
-      mod_file_struct.dsge_var_calibrated = it->second;
+    // Fill in mod_file_struct.dsge_var_calibrated
+    mod_file_struct.dsge_var_calibrated = it->second;
 
   // Fill in mod_file_struct.dsge_var_estimated
   OptionsList::string_options_t::const_iterator it_str = options_list.string_options.find("dsge_var");
@@ -881,15 +881,15 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
       exit(EXIT_FAILURE);
     }
 
-  if (options_list.string_options.find("datafile") == options_list.string_options.end() &&
-      !mod_file_struct.estimation_data_statement_present)
+  if (options_list.string_options.find("datafile") == options_list.string_options.end()
+      && !mod_file_struct.estimation_data_statement_present)
     {
       cerr << "ERROR: The estimation statement requires a data file to be supplied via the datafile option." << endl;
       exit(EXIT_FAILURE);
     }
 
-  if (options_list.string_options.find("mode_file") != options_list.string_options.end() &&
-      mod_file_struct.estim_params_use_calib)
+  if (options_list.string_options.find("mode_file") != options_list.string_options.end()
+      && mod_file_struct.estim_params_use_calib)
     {
       cerr << "ERROR: The mode_file option of the estimation statement is incompatible with the use_calibration option of the estimated_params_init block." << endl;
       exit(EXIT_FAILURE);
@@ -949,7 +949,7 @@ DynareSensitivityStatement::writeOutput(ostream &output, const string &basename,
   OptionsList::string_options_t::const_iterator it2 = options_list.string_options.find("graph_format");
   if (it2 != options_list.string_options.end())
     output << "options_.graph_format = '" << it2->second << "';" << endl;
-  
+
   output << "dynare_sensitivity(options_gsa);" << endl;
 }
 
@@ -973,7 +973,7 @@ void
 UnitRootVarsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
 {
   output << "options_.diffuse_filter = 1;" << endl
-	 << "options_.steadystate.nocheck = 1;" << endl;
+         << "options_.steadystate.nocheck = 1;" << endl;
 }
 
 PeriodsStatement::PeriodsStatement(int periods_arg) : periods(periods_arg)
@@ -1632,8 +1632,8 @@ MSSBVAREstimationStatement::checkPass(ModFileStructure &mod_file_struct, Warning
   mod_file_struct.bvar_present = true;
 
   if (options_list.num_options.find("ms.create_init") == options_list.num_options.end())
-    if (options_list.string_options.find("datafile") == options_list.string_options.end() ||
-        options_list.num_options.find("ms.initial_year") == options_list.num_options.end())
+    if (options_list.string_options.find("datafile") == options_list.string_options.end()
+        || options_list.num_options.find("ms.initial_year") == options_list.num_options.end())
       {
         cerr << "ERROR: If you do not pass no_create_init to ms_estimation, "
              << "you must pass the datafile and initial_year options." << endl;
@@ -1725,7 +1725,7 @@ MSSBVARComputeProbabilitiesStatement::writeOutput(ostream &output, const string
 }
 
 MSSBVARIrfStatement::MSSBVARIrfStatement(const SymbolList &symbol_list_arg,
-					 const OptionsList &options_list_arg) :
+                                         const OptionsList &options_list_arg) :
   symbol_list(symbol_list_arg),
   options_list(options_list_arg)
 {
@@ -1752,14 +1752,14 @@ MSSBVARIrfStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
   if (it != options_list.num_options.end())
     filtered_probabilities_present = true;
 
-  if ((filtered_probabilities_present && regime_present) ||
-      (filtered_probabilities_present && regimes_present) ||
-      (regimes_present && regime_present))
-      {
-        cerr << "ERROR: You may only pass one of regime, regimes and "
-             << "filtered_probabilities to ms_irf" << endl;
-        exit(EXIT_FAILURE);
-      }
+  if ((filtered_probabilities_present && regime_present)
+      || (filtered_probabilities_present && regimes_present)
+      || (regimes_present && regime_present))
+    {
+      cerr << "ERROR: You may only pass one of regime, regimes and "
+           << "filtered_probabilities to ms_irf" << endl;
+      exit(EXIT_FAILURE);
+    }
 }
 
 void
@@ -1823,14 +1823,14 @@ MSSBVARVarianceDecompositionStatement::checkPass(ModFileStructure &mod_file_stru
   if (it != options_list.num_options.end())
     filtered_probabilities_present = true;
 
-  if ((filtered_probabilities_present && regime_present) ||
-      (filtered_probabilities_present && regimes_present) ||
-      (regimes_present && regime_present))
-      {
-        cerr << "ERROR: You may only pass one of regime, regimes and "
-             << "filtered_probabilities to ms_variance_decomposition" << endl;
-        exit(EXIT_FAILURE);
-      }
+  if ((filtered_probabilities_present && regime_present)
+      || (filtered_probabilities_present && regimes_present)
+      || (regimes_present && regime_present))
+    {
+      cerr << "ERROR: You may only pass one of regime, regimes and "
+           << "filtered_probabilities to ms_variance_decomposition" << endl;
+      exit(EXIT_FAILURE);
+    }
 }
 
 void
@@ -2094,19 +2094,19 @@ SvarIdentificationStatement::writeOutput(ostream &output, const string &basename
       for (svar_identification_restrictions_t::const_iterator it = restrictions.begin(); it != restrictions.end(); it++)
         {
           assert(it->lag >= 0);
-	  if (it->lag == 0)
+          if (it->lag == 0)
             output << "options_.ms.Qi{" << it->equation << "}(" << it->restriction_nbr << ", " << it->variable + 1 << ") = ";
-	  else
-	    {
-	      int col = (it->lag-1)*n+it->variable+1;
-	      if (col > k)
+          else
+            {
+              int col = (it->lag-1)*n+it->variable+1;
+              if (col > k)
                 {
                   cerr << "ERROR: lag =" << it->lag << ", num endog vars = " << n << "current endog var index = " << it->variable << ". Index "
                        << "out of bounds. If the above does not represent a logical error, please report this to the Dyanre Team." << endl;
                   exit(EXIT_FAILURE);
                 }
-	      output << "options_.ms.Ri{" << it->equation << "}(" << it->restriction_nbr << ", " << col << ") = ";
-	    }
+              output << "options_.ms.Ri{" << it->equation << "}(" << it->restriction_nbr << ", " << col << ") = ";
+            }
           it->value->writeOutput(output);
           output << ";" << endl;
         }
@@ -2121,21 +2121,21 @@ MarkovSwitchingStatement::MarkovSwitchingStatement(const OptionsList &options_li
   if (it_num != options_list.num_options.end())
     {
       using namespace boost;
-      OptionsList::num_options_t::const_iterator it_num_regimes =
-        options_list.num_options.find("ms.number_of_regimes");
+      OptionsList::num_options_t::const_iterator it_num_regimes
+        = options_list.num_options.find("ms.number_of_regimes");
       assert(it_num_regimes !=  options_list.num_options.end());
       int num_regimes = lexical_cast< int >(it_num_regimes->second);
 
       vector<string> tokenizedRestrictions;
       split(tokenizedRestrictions, it_num->second, is_any_of("["), token_compress_on);
       for (vector<string>::iterator it = tokenizedRestrictions.begin();
-            it != tokenizedRestrictions.end(); it++ )
+           it != tokenizedRestrictions.end(); it++)
         if (it->size() > 0)
           {
             vector<string> restriction;
             split(restriction, *it, is_any_of("], "));
             for (vector<string>::iterator it1 = restriction.begin();
-                 it1 != restriction.end(); )
+                 it1 != restriction.end();)
               if (it1->empty())
                 restriction.erase(it1);
               else
@@ -2204,16 +2204,16 @@ MarkovSwitchingStatement::checkPass(ModFileStructure &mod_file_struct, WarningCo
   if (it_num != options_list.num_options.end())
     {
       using namespace boost;
-      OptionsList::num_options_t::const_iterator it_num_regimes =
-        options_list.num_options.find("ms.number_of_regimes");
+      OptionsList::num_options_t::const_iterator it_num_regimes
+        = options_list.num_options.find("ms.number_of_regimes");
       assert(it_num_regimes != options_list.num_options.end());
       int num_regimes = lexical_cast< int >(it_num_regimes->second);
-      vector<double> col_trans_prob_sum (num_regimes, 0);
-      vector<double> row_trans_prob_sum (num_regimes, 0);
-      vector<bool> all_restrictions_in_row (num_regimes, true);
-      vector<bool> all_restrictions_in_col (num_regimes, true);
-      for (int row=0; row<num_regimes; row++)
-        for (int col=0; col<num_regimes; col++)
+      vector<double> col_trans_prob_sum(num_regimes, 0);
+      vector<double> row_trans_prob_sum(num_regimes, 0);
+      vector<bool> all_restrictions_in_row(num_regimes, true);
+      vector<bool> all_restrictions_in_col(num_regimes, true);
+      for (int row = 0; row < num_regimes; row++)
+        for (int col = 0; col < num_regimes; col++)
           if (restriction_map.find(make_pair(row+1, col+1)) != restriction_map.end())
             {
               row_trans_prob_sum[row] += restriction_map[make_pair(row+1, col+1)];
@@ -2225,41 +2225,41 @@ MarkovSwitchingStatement::checkPass(ModFileStructure &mod_file_struct, WarningCo
               all_restrictions_in_col[col] = false;
             }
 
-      for (int i=0; i<num_regimes; i++)
+      for (int i = 0; i < num_regimes; i++)
         {
           if (all_restrictions_in_row[i])
-          {
-            if (row_trans_prob_sum[i] != 1.0)
+            {
+              if (row_trans_prob_sum[i] != 1.0)
+                {
+                  cerr << "ERROR: When all transitions probabilities are specified for a certain "
+                       << "regime, they must sum to 1" << endl;
+                  exit(EXIT_FAILURE);
+                }
+            }
+          else
+            if (row_trans_prob_sum[i] >= 1.0)
               {
-                cerr << "ERROR: When all transitions probabilities are specified for a certain "
-                     << "regime, they must sum to 1" << endl;
+                cerr << "ERROR: When transition probabilites are not specified for every regime, "
+                     << "their sum must be < 1" << endl;
                 exit(EXIT_FAILURE);
               }
-          }
-        else
-          if (row_trans_prob_sum[i] >= 1.0)
+
+          if (all_restrictions_in_col[i])
             {
-              cerr << "ERROR: When transition probabilites are not specified for every regime, "
-                   << "their sum must be < 1" << endl;
-              exit(EXIT_FAILURE);
+              if (col_trans_prob_sum[i] != 1.0)
+                {
+                  cerr << "ERROR: When all transitions probabilities are specified for a certain "
+                       << "regime, they must sum to 1" << endl;
+                  exit(EXIT_FAILURE);
+                }
             }
-
-        if (all_restrictions_in_col[i])
-          {
-            if (col_trans_prob_sum[i] != 1.0)
+          else
+            if (col_trans_prob_sum[i] >= 1.0)
               {
-                cerr << "ERROR: When all transitions probabilities are specified for a certain "
-                     << "regime, they must sum to 1" << endl;
+                cerr << "ERROR: When transition probabilites are not specified for every regime, "
+                     << "their sum must be < 1" << endl;
                 exit(EXIT_FAILURE);
               }
-          }
-        else
-          if (col_trans_prob_sum[i] >= 1.0)
-            {
-              cerr << "ERROR: When transition probabilites are not specified for every regime, "
-                   << "their sum must be < 1" << endl;
-              exit(EXIT_FAILURE);
-            }
         }
     }
 
@@ -2296,7 +2296,7 @@ MarkovSwitchingStatement::writeOutput(ostream &output, const string &basename, b
     }
 
   int restrictions_index = 0;
-  for (itR=restriction_map.begin(); itR != restriction_map.end(); itR++)
+  for (itR = restriction_map.begin(); itR != restriction_map.end(); itR++)
     output << "options_.ms.ms_chain(" << itChain->second << ").restrictions("
            << ++restrictions_index << ") = {[" << itR->first.first << ", "
            << itR->first.second << ", " << itR->second << "]};" << endl;
@@ -2307,8 +2307,8 @@ MarkovSwitchingStatement::writeCOutput(ostream &output, const string &basename)
 {
   output << endl;
 
-  OptionsList::num_options_t::const_iterator it =
-    options_list.num_options.find("ms.chain");
+  OptionsList::num_options_t::const_iterator it
+    = options_list.num_options.find("ms.chain");
   assert(it !=  options_list.num_options.end());
   output << "chain = " << it->second << ";" << endl;
 
@@ -2330,17 +2330,17 @@ MarkovSwitchingStatement::writeCOutput(ostream &output, const string &basename)
   vector<string> tokenizedDomain;
   split(tokenizedDomain, it->second, is_any_of("[ ]"), token_compress_on);
   for (vector<string>::iterator itvs = tokenizedDomain.begin();
-       itvs != tokenizedDomain.end(); itvs++ )
+       itvs != tokenizedDomain.end(); itvs++)
     if (!itvs->empty())
       output << "duration.push_back(" << *itvs << ");" << endl;
 
-  OptionsList::symbol_list_options_t::const_iterator itsl =
-    options_list.symbol_list_options.find("ms.parameters");
+  OptionsList::symbol_list_options_t::const_iterator itsl
+    = options_list.symbol_list_options.find("ms.parameters");
   assert(itsl != options_list.symbol_list_options.end());
   vector<string> parameters = itsl->second.get_symbols();
   output << "parameters.clear();" << endl;
   for (vector<string>::iterator itp = parameters.begin();
-       itp != parameters.end(); itp++ )
+       itp != parameters.end(); itp++)
     output << "parameters.push_back(param_names[\"" << *itp << "\"]);" << endl;
 
   output << "restriction_map.clear();" << endl;
@@ -2367,13 +2367,13 @@ SvarStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation
   it2 = options_list.string_options.find("ms.constants");
   assert((it0 != options_list.string_options.end()
           && it1 == options_list.string_options.end()
-          && it2 == options_list.string_options.end()) ||
-         (it0 == options_list.string_options.end()
-          && it1 != options_list.string_options.end()
-          && it2 == options_list.string_options.end()) ||
-         (it0 == options_list.string_options.end()
-          && it1 == options_list.string_options.end()
-          && it2 != options_list.string_options.end()));
+          && it2 == options_list.string_options.end())
+         || (it0 == options_list.string_options.end()
+             && it1 != options_list.string_options.end()
+             && it2 == options_list.string_options.end())
+         || (it0 == options_list.string_options.end()
+             && it1 == options_list.string_options.end()
+             && it2 != options_list.string_options.end()));
 }
 
 void
@@ -2456,15 +2456,15 @@ EstimationDataStatement::checkPass(ModFileStructure &mod_file_struct, WarningCon
         exit(EXIT_FAILURE);
       }
 
-  if ((options_list.string_options.find("file") == options_list.string_options.end()) &&
-      (options_list.string_options.find("series") == options_list.string_options.end()))
+  if ((options_list.string_options.find("file") == options_list.string_options.end())
+      && (options_list.string_options.find("series") == options_list.string_options.end()))
     {
       cerr << "ERROR: The file or series option must be passed to the data statement." << endl;
       exit(EXIT_FAILURE);
     }
 
-  if ((options_list.string_options.find("file") != options_list.string_options.end()) &&
-      (options_list.string_options.find("series") != options_list.string_options.end()))
+  if ((options_list.string_options.find("file") != options_list.string_options.end())
+      && (options_list.string_options.find("series") != options_list.string_options.end()))
     {
       cerr << "ERROR: The file and series options cannot be used simultaneously in the data statement." << endl;
       exit(EXIT_FAILURE);
@@ -2636,8 +2636,8 @@ JointPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
       exit(EXIT_FAILURE);
     }
 
-  if (options_list.num_options.find("mean") == options_list.num_options.end() &&
-      options_list.num_options.find("mode") == options_list.num_options.end())
+  if (options_list.num_options.find("mean") == options_list.num_options.end()
+      && options_list.num_options.find("mode") == options_list.num_options.end())
     {
       cerr << "ERROR: You must pass at least one of mean and mode to the prior statement." << endl;
       exit(EXIT_FAILURE);
@@ -2660,13 +2660,13 @@ JointPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
 void
 JointPriorStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
 {
-  for (vector<string>::const_iterator it = joint_parameters.begin() ; it != joint_parameters.end(); it++)
+  for (vector<string>::const_iterator it = joint_parameters.begin(); it != joint_parameters.end(); it++)
     output << "eifind = get_new_or_existing_ei_index('joint_parameter_prior_index', '"
            << *it << "', '');" << endl
            << "estimation_info.joint_parameter_prior_index(eifind) = {'" << *it << "'};" << endl;
 
   output << "key = {[";
-  for (vector<string>::const_iterator it = joint_parameters.begin() ; it != joint_parameters.end(); it++)
+  for (vector<string>::const_iterator it = joint_parameters.begin(); it != joint_parameters.end(); it++)
     output << "get_new_or_existing_ei_index('joint_parameter_prior_index', '" << *it << "', '') ..."
            << endl << "    ";
   output << "]};" << endl;
@@ -2707,18 +2707,17 @@ JointPriorStatement::writeOutputHelper(ostream &output, const string &field, con
 {
   OptionsList::num_options_t::const_iterator itn = options_list.num_options.find(field);
   output << lhs_field << "." << field << " = {";
-  if (field=="variance")
+  if (field == "variance")
     output << "{";
   if (itn != options_list.num_options.end())
     output << itn->second;
   else
     output << "{}";
-  if (field=="variance")
+  if (field == "variance")
     output << "}";
   output << "};" << endl;
 }
 
-
 BasicPriorStatement::~BasicPriorStatement()
 {
 }
@@ -2745,16 +2744,16 @@ BasicPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
       exit(EXIT_FAILURE);
     }
 
-  if (options_list.num_options.find("mean") == options_list.num_options.end() &&
-      options_list.num_options.find("mode") == options_list.num_options.end())
+  if (options_list.num_options.find("mean") == options_list.num_options.end()
+      && options_list.num_options.find("mode") == options_list.num_options.end())
     {
       cerr << "ERROR: You must pass at least one of mean and mode to the prior statement." << endl;
       exit(EXIT_FAILURE);
     }
 
   OptionsList::num_options_t::const_iterator it_stdev = options_list.num_options.find("stdev");
-  if ((it_stdev == options_list.num_options.end() && variance == NULL) ||
-      (it_stdev != options_list.num_options.end() && variance != NULL))
+  if ((it_stdev == options_list.num_options.end() && variance == NULL)
+      || (it_stdev != options_list.num_options.end() && variance != NULL))
     {
       cerr << "ERROR: You must pass exactly one of stdev and variance to the prior statement." << endl;
       exit(EXIT_FAILURE);
@@ -2861,7 +2860,7 @@ BasicPriorStatement::writeCDomain(ostream &output) const
       vector<string> tokenizedDomain;
       split(tokenizedDomain, it_num->second, is_any_of("[ ]"), token_compress_on);
       for (vector<string>::iterator it = tokenizedDomain.begin();
-           it != tokenizedDomain.end(); it++ )
+           it != tokenizedDomain.end(); it++)
         if (!it->empty())
           output << "domain.push_back(" << *it << ");" << endl;
     }
@@ -2884,28 +2883,28 @@ BasicPriorStatement::writeCShape(ostream &output) const
   switch (prior_shape)
     {
     case eBeta:
-      output  << "\"beta\";" << endl;
+      output << "\"beta\";" << endl;
       break;
     case eGamma:
-      output  << "\"gamma\";" << endl;
+      output << "\"gamma\";" << endl;
       break;
     case eNormal:
-      output  << "\"normal\";" << endl;
+      output << "\"normal\";" << endl;
       break;
     case eInvGamma:
-      output  << "\"inv_gamma\";" << endl;
+      output << "\"inv_gamma\";" << endl;
       break;
     case eUniform:
-      output  << "\"uniform\";" << endl;
+      output << "\"uniform\";" << endl;
       break;
     case eInvGamma2:
-      output  << "\"inv_gamma2\";" << endl;
+      output << "\"inv_gamma2\";" << endl;
       break;
     case eDirichlet:
-      output  << "\"dirichlet\";" << endl;
+      output << "\"dirichlet\";" << endl;
       break;
     case eWeibull:
-      output  << "\"weibull\";" << endl;
+      output << "\"weibull\";" << endl;
       break;
     case eNoShape:
       assert(prior_shape != eNoShape);
@@ -2952,7 +2951,7 @@ StdPriorStatement::StdPriorStatement(const string &name_arg,
                                      const PriorDistributions &prior_shape_arg,
                                      const expr_t &variance_arg,
                                      const OptionsList &options_list_arg,
-                                     const SymbolTable &symbol_table_arg ) :
+                                     const SymbolTable &symbol_table_arg) :
   BasicPriorStatement(name_arg, subsample_name_arg, prior_shape_arg, variance_arg, options_list_arg),
   symbol_table(symbol_table_arg)
 {
@@ -3001,7 +3000,7 @@ CorrPriorStatement::CorrPriorStatement(const string &name_arg1, const string &na
                                        const PriorDistributions &prior_shape_arg,
                                        const expr_t &variance_arg,
                                        const OptionsList &options_list_arg,
-                                       const SymbolTable &symbol_table_arg ) :
+                                       const SymbolTable &symbol_table_arg) :
   BasicPriorStatement(name_arg1, subsample_name_arg, prior_shape_arg, variance_arg, options_list_arg),
   name1(name_arg2),
   symbol_table(symbol_table_arg)
@@ -3092,8 +3091,8 @@ PriorEqualStatement::PriorEqualStatement(const string &to_declaration_type_arg,
 void
 PriorEqualStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
 {
-  if ((to_declaration_type != "par" && to_declaration_type != "std" && to_declaration_type != "corr") ||
-      (from_declaration_type != "par" && from_declaration_type != "std" && from_declaration_type != "corr"))
+  if ((to_declaration_type != "par" && to_declaration_type != "std" && to_declaration_type != "corr")
+      || (from_declaration_type != "par" && from_declaration_type != "std" && from_declaration_type != "corr"))
     {
       cerr << "Internal Dynare Error" << endl;
       exit(EXIT_FAILURE);
@@ -3124,7 +3123,6 @@ PriorEqualStatement::writeOutput(ostream &output, const string &basename, bool m
   else
     get_base_name(symbol_table.getType(from_name1), rhs_field);
 
-
   if (to_declaration_type == "corr")
     lhs_field += "_corr";
 
@@ -3277,7 +3275,7 @@ OptionsStatement::writeCOutput(ostream &output, const string &basename)
 StdOptionsStatement::StdOptionsStatement(const string &name_arg,
                                          const string &subsample_name_arg,
                                          const OptionsList &options_list_arg,
-                                         const SymbolTable &symbol_table_arg ) :
+                                         const SymbolTable &symbol_table_arg) :
   BasicOptionsStatement(name_arg, subsample_name_arg, options_list_arg),
   symbol_table(symbol_table_arg)
 {
@@ -3319,7 +3317,7 @@ StdOptionsStatement::writeCOutput(ostream &output, const string &basename)
 CorrOptionsStatement::CorrOptionsStatement(const string &name_arg1, const string &name_arg2,
                                            const string &subsample_name_arg,
                                            const OptionsList &options_list_arg,
-                                           const SymbolTable &symbol_table_arg ) :
+                                           const SymbolTable &symbol_table_arg) :
   BasicOptionsStatement(name_arg1, subsample_name_arg, options_list_arg),
   name1(name_arg2),
   symbol_table(symbol_table_arg)
@@ -3404,8 +3402,8 @@ OptionsEqualStatement::OptionsEqualStatement(const string &to_declaration_type_a
 void
 OptionsEqualStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
 {
-  if ((to_declaration_type != "par" && to_declaration_type != "std" && to_declaration_type != "corr") ||
-      (from_declaration_type != "par" && from_declaration_type != "std" && from_declaration_type != "corr"))
+  if ((to_declaration_type != "par" && to_declaration_type != "std" && to_declaration_type != "corr")
+      || (from_declaration_type != "par" && from_declaration_type != "std" && from_declaration_type != "corr"))
     {
       cerr << "Internal Dynare Error" << endl;
       exit(EXIT_FAILURE);
@@ -3436,7 +3434,6 @@ OptionsEqualStatement::writeOutput(ostream &output, const string &basename, bool
   else
     get_base_name(symbol_table.getType(from_name1), rhs_field);
 
-
   if (to_declaration_type == "corr")
     lhs_field += "_corr";
 
diff --git a/ComputingTasks.hh b/ComputingTasks.hh
index 3c675718f9ab0565ed570e83db065d18bf716e57..0291cc9e5c4fcee1bb9b73ea3802cf03fb4dca55 100644
--- a/ComputingTasks.hh
+++ b/ComputingTasks.hh
@@ -181,7 +181,7 @@ private:
   const OptionsList options_list;
 public:
   RamseyModelStatement(const SymbolList &symbol_list_arg,
-                        const OptionsList &options_list_arg);
+                       const OptionsList &options_list_arg);
   virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
   virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
 };
@@ -189,11 +189,12 @@ public:
 class RamseyConstraintsStatement : public Statement
 {
 public:
-  struct Constraint {
+  struct Constraint
+  {
     int endo;
     BinaryOpcode code;
     expr_t expression;
-  }; 
+  };
   typedef vector<Constraint> constraints_t;
 private:
   const constraints_t constraints;
@@ -226,7 +227,7 @@ private:
   const OptionsList options_list;
 public:
   DiscretionaryPolicyStatement(const SymbolList &symbol_list_arg,
-			       const OptionsList &options_list_arg);
+                               const OptionsList &options_list_arg);
   virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
   virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
 };
@@ -476,7 +477,8 @@ public:
   /*! \param model_tree_arg the model tree used to store the objective function.
     It is owned by the PlannerObjectiveStatement, and will be deleted by its destructor */
   PlannerObjectiveStatement(StaticModel *model_tree_arg);
-  virtual ~PlannerObjectiveStatement();
+  virtual
+  ~PlannerObjectiveStatement();
   /*! \todo check there are only endogenous variables at the current period in the objective
     (no exogenous, no lead/lag) */
   virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
@@ -566,7 +568,7 @@ private:
   const OptionsList options_list;
 public:
   MSSBVARIrfStatement(const SymbolList &symbol_list_arg,
-		      const OptionsList &options_list_arg);
+                      const OptionsList &options_list_arg);
   virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
   virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
 };
@@ -726,7 +728,7 @@ public:
     int lag;
     int variable;
     expr_t value;
-  };    
+  };
 
   typedef vector< svar_identification_restriction > svar_identification_restrictions_t;
 private:
@@ -740,7 +742,7 @@ public:
   SvarIdentificationStatement(const svar_identification_restrictions_t &restrictions_arg,
                               const bool &upper_cholesky_present_arg,
                               const bool &lower_cholesky_present_arg,
-			      const bool &constants_exclusion_present_arg,
+                              const bool &constants_exclusion_present_arg,
                               const SymbolTable &symbol_table_arg);
   virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
   virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
@@ -845,11 +847,11 @@ public:
   void writeOutputHelper(ostream &output, const string &field, const string &lhs_field) const;
 };
 
-
 class BasicPriorStatement : public Statement
 {
 public:
-  virtual ~BasicPriorStatement();
+  virtual
+  ~BasicPriorStatement();
 protected:
   const string name;
   const string subsample_name;
@@ -952,7 +954,8 @@ public:
 class BasicOptionsStatement : public Statement
 {
 public:
-  virtual ~BasicOptionsStatement();
+  virtual
+  ~BasicOptionsStatement();
 protected:
   const string name;
   const string subsample_name;
diff --git a/ConfigFile.cc b/ConfigFile.cc
index d1fbd8b7bfb2528025e4ff5182729bd359ca780f..36a1faa7d164be55fe3668b09545d07f53b5d0d3 100644
--- a/ConfigFile.cc
+++ b/ConfigFile.cc
@@ -102,7 +102,7 @@ ConfigFile::getConfigFileInfo(const string &config_file)
 
   if (config_file.empty())
     {
-      string defaultConfigFile ("");
+      string defaultConfigFile("");
       // Test OS and try to open default file
 #if defined(_WIN32) || defined(__CYGWIN32__)
       if (getenv("APPDATA") == NULL)
@@ -122,42 +122,41 @@ ConfigFile::getConfigFileInfo(const string &config_file)
           defaultConfigFile += "\\dynare.ini";
         }
 #else
-        if (getenv("HOME") == NULL)
-          {
-            if (parallel || parallel_test)
-              cerr << "ERROR: ";
-            else
-              cerr << "WARNING: ";
-            cerr << "HOME environment variable not found." << endl;
-            if (parallel || parallel_test)
-              exit(EXIT_FAILURE);
-          }
-        else
-          {
-            defaultConfigFile += getenv("HOME");
-            defaultConfigFile += "/.dynare";
-          }
-#endif
-        configFile = new ifstream(defaultConfigFile.c_str(), fstream::in);
-        if (!configFile->is_open())
+      if (getenv("HOME") == NULL)
+        {
           if (parallel || parallel_test)
-            {
-              cerr << "ERROR: Could not open the default config file (" << defaultConfigFile << ")" << endl;
-              exit(EXIT_FAILURE);
-            }
+            cerr << "ERROR: ";
           else
-            return;
-      }
-    else
-      {
-        configFile = new ifstream(config_file.c_str(), fstream::in);
-        if (!configFile->is_open())
+            cerr << "WARNING: ";
+          cerr << "HOME environment variable not found." << endl;
+          if (parallel || parallel_test)
+            exit(EXIT_FAILURE);
+        }
+      else
+        {
+          defaultConfigFile += getenv("HOME");
+          defaultConfigFile += "/.dynare";
+        }
+#endif
+      configFile = new ifstream(defaultConfigFile.c_str(), fstream::in);
+      if (!configFile->is_open())
+        if (parallel || parallel_test)
           {
-            cerr << "ERROR: Couldn't open file " << config_file << endl;;
+            cerr << "ERROR: Could not open the default config file (" << defaultConfigFile << ")" << endl;
             exit(EXIT_FAILURE);
           }
-      }
-
+        else
+          return;
+    }
+  else
+    {
+      configFile = new ifstream(config_file.c_str(), fstream::in);
+      if (!configFile->is_open())
+        {
+          cerr << "ERROR: Couldn't open file " << config_file << endl;;
+          exit(EXIT_FAILURE);
+        }
+    }
 
   string name, computerName, port, userName, password, remoteDrive,
     remoteDirectory, dynarePath, matlabOctavePath, operatingSystem,
@@ -271,7 +270,7 @@ ConfigFile::getConfigFileInfo(const string &config_file)
                   vector<string> tokenizedPath;
                   split(tokenizedPath, tokenizedLine.back(), is_any_of(":"), token_compress_on);
                   for (vector<string>::iterator it = tokenizedPath.begin();
-                       it != tokenizedPath.end(); it++ )
+                       it != tokenizedPath.end(); it++)
                     if (!it->empty())
                       {
                         trim(*it);
@@ -375,7 +374,7 @@ ConfigFile::getConfigFileInfo(const string &config_file)
                 for (tokenizer<char_separator<char> >::iterator it = tokens.begin();
                      it != tokens.end(); it++)
                   {
-                    string token (*it);
+                    string token(*it);
                     if (token.compare("(") == 0)
                       {
                         begin_weight = true;
@@ -525,10 +524,10 @@ void
 ConfigFile::checkPass(WarningConsolidation &warnings) const
 {
   bool global_init_file_declared = false;
-  for (vector<Hook *>::const_iterator it = hooks.begin() ; it != hooks.end(); it++)
+  for (vector<Hook *>::const_iterator it = hooks.begin(); it != hooks.end(); it++)
     {
       const map <string, string> hookmap = (*it)->get_hooks();
-      for (map <string, string>::const_iterator mapit = hookmap.begin() ; mapit != hookmap.end(); mapit++)
+      for (map <string, string>::const_iterator mapit = hookmap.begin(); mapit != hookmap.end(); mapit++)
         if (mapit->first.compare("global_init_file") == 0)
           if (global_init_file_declared == true)
             {
@@ -686,10 +685,10 @@ vector<string>
 ConfigFile::getIncludePaths() const
 {
   vector<string> include_paths;
-  for (vector<Path *>::const_iterator it = paths.begin() ; it != paths.end(); it++)
+  for (vector<Path *>::const_iterator it = paths.begin(); it != paths.end(); it++)
     {
       map <string, vector<string> > pathmap = (*it)->get_paths();
-      for (map <string, vector<string> >::const_iterator mapit = pathmap.begin() ; mapit != pathmap.end(); mapit++)
+      for (map <string, vector<string> >::const_iterator mapit = pathmap.begin(); mapit != pathmap.end(); mapit++)
         for (vector<string>::const_iterator vecit = mapit->second.begin(); vecit != mapit->second.end(); vecit++)
           include_paths.push_back(*vecit);
     }
@@ -699,10 +698,10 @@ ConfigFile::getIncludePaths() const
 void
 ConfigFile::writeHooks(ostream &output) const
 {
-  for (vector<Hook *>::const_iterator it = hooks.begin() ; it != hooks.end(); it++)
+  for (vector<Hook *>::const_iterator it = hooks.begin(); it != hooks.end(); it++)
     {
       map <string, string> hookmap = (*it)->get_hooks();
-      for (map <string, string>::const_iterator mapit = hookmap.begin() ; mapit != hookmap.end(); mapit++)
+      for (map <string, string>::const_iterator mapit = hookmap.begin(); mapit != hookmap.end(); mapit++)
         output << "options_." << mapit->first << " = '" << mapit->second << "';" << endl;
     }
 }
diff --git a/ConfigFile.hh b/ConfigFile.hh
index 3c761753b6edb4da167beb9849a72c3de6cc2a81..e054922f71d00d8d2bcdafffbf1f736100bd2d6c 100644
--- a/ConfigFile.hh
+++ b/ConfigFile.hh
@@ -37,18 +37,26 @@ public:
 private:
   map<string, string> hooks;
 public:
-  inline map<string, string>get_hooks() { return hooks; };
+  inline map<string, string>
+  get_hooks()
+  {
+    return hooks;
+  };
 };
 
 class Path
 {
 public:
-    Path(vector<string> &includepath_arg);
+  Path(vector<string> &includepath_arg);
   ~Path();
 private:
   map<string, vector<string> > paths;
 public:
-  inline map<string, vector<string> >get_paths() { return paths; };
+  inline map<string, vector<string> >
+  get_paths()
+  {
+    return paths;
+  };
 };
 
 class SlaveNode
diff --git a/DataTree.hh b/DataTree.hh
index e7acd6ca33f9b3f434cb72aea51292cb9c6d129f..72b12ddbe7ff24bf81ea3d75ce56dbcf88eba4ea 100644
--- a/DataTree.hh
+++ b/DataTree.hh
@@ -109,7 +109,8 @@ private:
 
 public:
   DataTree(SymbolTable &symbol_table_arg, NumericalConstants &num_constants_arg, ExternalFunctionsTable &external_functions_table_arg);
-  virtual ~DataTree();
+  virtual
+  ~DataTree();
 
   //! Some predefined constants
   expr_t Zero, One, Two, MinusOne, NaN, Infinity, MinusInfinity, Pi;
diff --git a/DynamicModel.cc b/DynamicModel.cc
index 12658291f8fdd5ad0b623e2105a4ff081cf5d1ed..42eaab23a184adb5537f2f7e050fe985c23b0561 100644
--- a/DynamicModel.cc
+++ b/DynamicModel.cc
@@ -881,7 +881,7 @@ DynamicModel::writeModelEquationsCode(string &file_name, const string &bin_basen
             count_col_det_exo++;
         }
     }
-  
+
   FBEGINBLOCK_ fbeginblock(symbol_table.endo_nbr(),
                            simulation_type,
                            0,
@@ -1140,30 +1140,30 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
         for (var_t::const_iterator it1 = it->second.begin(); it1 != it->second.end(); it1++)
           {
             count_col_det_exo++;
-            if (find (exo_det.begin(), exo_det.end(), *it1) == exo_det.end())
+            if (find(exo_det.begin(), exo_det.end(), *it1) == exo_det.end())
               exo_det.push_back(*it1);
           }
-            
+
       unsigned int count_col_exo = 0;
       vector<unsigned int> exo;
       for (lag_var_t::const_iterator it = exo_block[block].begin(); it != exo_block[block].end(); it++)
         for (var_t::const_iterator it1 = it->second.begin(); it1 != it->second.end(); it1++)
           {
             count_col_exo++;
-            if (find (exo.begin(), exo.end(), *it1) == exo.end())
+            if (find(exo.begin(), exo.end(), *it1) == exo.end())
               exo.push_back(*it1);
           }
-          
+
       vector<unsigned int> other_endo;
       unsigned int count_col_other_endo = 0;
       for (lag_var_t::const_iterator it = other_endo_block[block].begin(); it != other_endo_block[block].end(); it++)
         for (var_t::const_iterator it1 = it->second.begin(); it1 != it->second.end(); it1++)
           {
             count_col_other_endo++;
-            if (find (other_endo.begin(), other_endo.end(), *it1) == other_endo.end())
-                other_endo.push_back(*it1);
+            if (find(other_endo.begin(), other_endo.end(), *it1) == other_endo.end())
+              other_endo.push_back(*it1);
           }
-          
+
       FBEGINBLOCK_ fbeginblock(block_mfs,
                                simulation_type,
                                getBlockFirstEquation(block),
@@ -1187,7 +1187,7 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
                                other_endo
                                );
       fbeginblock.write(code_file, instruction_number);
-      
+
       // The equations
       for (i = 0; i < (int) block_size; i++)
         {
@@ -1202,10 +1202,10 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
                   if (dynamic_cast<AbstractExternalFunctionNode *>(*it) != NULL)
                     (*it)->compileExternalFunctionOutput(code_file, instruction_number, false, tt2, map_idx, true, false, tef_terms);
 
-                  FNUMEXPR_ fnumexpr(TemporaryTerm, (int) (map_idx.find((*it)->idx)->second));
+                  FNUMEXPR_ fnumexpr(TemporaryTerm, (int)(map_idx.find((*it)->idx)->second));
                   fnumexpr.write(code_file, instruction_number);
                   (*it)->compile(code_file, instruction_number, false, tt2, map_idx, true, false, tef_terms);
-                  FSTPT_ fstpt((int) (map_idx.find((*it)->idx)->second));
+                  FSTPT_ fstpt((int)(map_idx.find((*it)->idx)->second));
                   fstpt.write(code_file, instruction_number);
                   // Insert current node into tt2
                   tt2.insert(*it);
@@ -1543,7 +1543,7 @@ DynamicModel::writeDynamicMFile(const string &dynamic_basename) const
                     << "% Outputs:" << endl
                     << "%   residual  [M_.endo_nbr by 1] double    vector of residuals of the dynamic model equations in order of " << endl
                     << "%                                          declaration of the equations." << endl
-					<< "%                                          Dynare may prepend auxiliary equations, see M_.aux_vars" << endl
+                    << "%                                          Dynare may prepend auxiliary equations, see M_.aux_vars" << endl
                     << "%   g1        [M_.endo_nbr by #dynamic variables] double    Jacobian matrix of the dynamic model equations;" << endl
                     << "%                                                           rows: equations in order of declaration" << endl
                     << "%                                                           columns: variables in order stored in M_.lead_lag_incidence followed by the ones in M_.exo_names" << endl
@@ -1554,7 +1554,7 @@ DynamicModel::writeDynamicMFile(const string &dynamic_basename) const
                     << "%                                                              rows: equations in order of declaration" << endl
                     << "%                                                              columns: variables in order stored in M_.lead_lag_incidence followed by the ones in M_.exo_names" << endl
                     << "%" << endl
-                    << "%" << endl                    
+                    << "%" << endl
                     << "% Warning : this file is generated automatically by Dynare" << endl
                     << "%           from model file (.mod)" << endl << endl;
 
@@ -1989,11 +1989,11 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
                     << "  else" << endl
                     << "    mthd='UNKNOWN';" << endl
                     << "  end;" << endl
-		    << "  if options_.verbosity" << endl 
+                    << "  if options_.verbosity" << endl
                     << "    printline(41)" << endl
                     << "    disp(sprintf('MODEL SIMULATION (method=%s):',mthd))" << endl
-		    << "    skipline()" << endl
-		    << "  end" << endl
+                    << "    skipline()" << endl
+                    << "  end" << endl
                     << "  periods=options_.periods;" << endl
                     << "  maxit_=options_.simul.maxit;" << endl
                     << "  solve_tolf=options_.solve_tolf;" << endl
@@ -2030,7 +2030,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
           mDynamicModelFile << "  g1=[];g2=[];g3=[];\n";
           mDynamicModelFile << "  y=" << dynamic_basename << "_" << block + 1 << "(y, x, params, steady_state, 0, y_kmin, periods);\n";
           mDynamicModelFile << "  tmp = y(:,M_.block_structure.block(" << block + 1 << ").variable);\n";
-	  mDynamicModelFile << "  if any(isnan(tmp) | isinf(tmp))\n";
+          mDynamicModelFile << "  if any(isnan(tmp) | isinf(tmp))\n";
           mDynamicModelFile << "    disp(['Inf or Nan value during the evaluation of block " << block <<"']);\n";
           mDynamicModelFile << "    oo_.deterministic_simulation.status = 0;\n";
           mDynamicModelFile << "    oo_.deterministic_simulation.error = 100;\n";
@@ -2406,7 +2406,7 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia
                     << jacobian_output.str()
                     << endl
 
-      // Initialize g2 matrix
+        // Initialize g2 matrix
                     << "if nargout >= 3," << endl
                     << "  %" << endl
                     << "  % Hessian matrix" << endl
@@ -2596,17 +2596,17 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
 
   output << modstruct << "lead_lag_incidence = [";
   // Loop on endogenous variables
-  int nstatic = 0, 
-      nfwrd   = 0,
-      npred   = 0,
-      nboth   = 0;
+  int nstatic = 0,
+    nfwrd   = 0,
+    npred   = 0,
+    nboth   = 0;
   for (int endoID = 0; endoID < symbol_table.endo_nbr(); endoID++)
     {
       output << endl;
-      int sstatic = 1, 
-          sfwrd   = 0,
-          spred   = 0,
-          sboth   = 0;
+      int sstatic = 1,
+        sfwrd   = 0,
+        spred   = 0,
+        sboth   = 0;
       // Loop on periods
       for (int lag = -max_endo_lag; lag <= max_endo_lead; lag++)
         {
@@ -2802,29 +2802,29 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
                 i++;
               }
           output << "];\n";
-          
+
           //vector<int> inter_state_var;
           output << "block_structure.block(" << block+1 << ").tm1 = zeros(" << i << ", " << state_var.size() << ");\n";
           int count_other_endogenous = 1;
           for (set<int>::const_iterator it_other_endogenous = other_endogenous.begin(); it_other_endogenous != other_endogenous.end(); it_other_endogenous++)
             {
-              for (vector<int>::const_iterator it=state_var.begin(); it != state_var.end(); it++)
+              for (vector<int>::const_iterator it = state_var.begin(); it != state_var.end(); it++)
                 {
                   //cout << "block = " << block+1 << " state_var = " << *it << " it_other_endogenous=" << *it_other_endogenous + 1 << "\n";
                   if (*it == *it_other_endogenous + 1)
                     {
-                      output << "block_structure.block(" << block+1 << ").tm1(" 
-                             << count_other_endogenous << ", " 
+                      output << "block_structure.block(" << block+1 << ").tm1("
+                             << count_other_endogenous << ", "
                              << it - state_var.begin()+1 << ") = 1;\n";
-                      /*output << "block_structure.block(" << block+1 << ").tm1(" 
-                             << it - state_var.begin()+1 << ", " 
-                             << count_other_endogenous << ") = 1;\n";*/
+                      /*output << "block_structure.block(" << block+1 << ").tm1("
+                        << it - state_var.begin()+1 << ", "
+                        << count_other_endogenous << ") = 1;\n";*/
                       //cout << "=>\n";
                     }
                 }
               count_other_endogenous++;
             }
-            
+
           output << "block_structure.block(" << block+1 << ").other_endo_nbr = " << i << ";\n";
 
           tmp_s.str("");
@@ -2851,10 +2851,10 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
                         }
                       else if (lag == 0)
                         {
-                          if (find( local_state_var.begin(), local_state_var.end(), getBlockVariableID(block, it->first.second.first)+1) == local_state_var.end())
+                          if (find(local_state_var.begin(), local_state_var.end(), getBlockVariableID(block, it->first.second.first)+1) == local_state_var.end())
                             {
-                               local_stat_var.push_back(getBlockVariableID(block, it->first.second.first)+1);
-                               n_static++;
+                              local_stat_var.push_back(getBlockVariableID(block, it->first.second.first)+1);
+                              n_static++;
                             }
                         }
                       else
@@ -2866,7 +2866,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
                             }
                           else
                             {
-                              if (find(local_stat_var.begin(), local_stat_var.end(),getBlockVariableID(block, it->first.second.first)+1) != local_stat_var.end())
+                              if (find(local_stat_var.begin(), local_stat_var.end(), getBlockVariableID(block, it->first.second.first)+1) != local_stat_var.end())
                                 n_static--;
                               n_forward++;
                             }
@@ -2886,13 +2886,13 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
               tmp_s.str("");
             }
           vector<int> inter_state_var;
-          for (vector<int>::const_iterator it_l=local_state_var.begin(); it_l != local_state_var.end(); it_l++)
-            for (vector<int>::const_iterator it=state_var.begin(); it != state_var.end(); it++)
+          for (vector<int>::const_iterator it_l = local_state_var.begin(); it_l != local_state_var.end(); it_l++)
+            for (vector<int>::const_iterator it = state_var.begin(); it != state_var.end(); it++)
               if (*it == *it_l)
                 inter_state_var.push_back(it - state_var.begin()+1);
           output << "block_structure.block(" << block+1 << ").sorted_col_dr_ghx = [";
-          for (vector<int>::const_iterator it=inter_state_var.begin(); it != inter_state_var.end(); it++)
-              output << *it << " ";
+          for (vector<int>::const_iterator it = inter_state_var.begin(); it != inter_state_var.end(); it++)
+            output << *it << " ";
           output << "];\n";
           count_lead_lag_incidence = 0;
           output << "block_structure.block(" << block+1 << ").lead_lag_incidence_other = [];\n";
@@ -2937,10 +2937,10 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
       output << "];\n";
       vector<int> variable_inv_reordered(nb_endo);
 
-      for (int i = 0; i< nb_endo; i++)
+      for (int i = 0; i < nb_endo; i++)
         variable_inv_reordered[variable_reordered[i]] = i;
- 
-      for (vector<int>::const_iterator it=state_var.begin(); it != state_var.end(); it++)
+
+      for (vector<int>::const_iterator it = state_var.begin(); it != state_var.end(); it++)
         state_equ.push_back(equation_reordered[variable_inv_reordered[*it - 1]]+1);
 
       map<pair< int, pair<int, int> >,  int>  lag_row_incidence;
@@ -2993,11 +2993,11 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
             i_nz_state_var[i] = n;
           unsigned int lp = n_obs;
 
-          for (unsigned int block = 0;  block < nb_blocks; block++)
+          for (unsigned int block = 0; block < nb_blocks; block++)
             {
               int block_size = getBlockSize(block);
               int nze = 0;
-              
+
               for (int i = 0; i < block_size; i++)
                 {
                   int var = getBlockVariableID(block, i);
@@ -3016,22 +3016,21 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
                           vector<int>::const_iterator it_state_equ = find(state_equ.begin(), state_equ.end(), getBlockEquationID(block, it->first.first)+1);
                           if (it_state_equ != state_equ.end())
                             row_state_var_incidence.insert(make_pair(it_state_equ - state_equ.begin(), it_state_var - state_var.begin()));
-                        }  
-                      
-                      
+                        }
+
                     }
                   /*tmp_block_endo_derivative[make_pair(it->second.first, make_pair(it->first.second, it->first.first))] = it->second.second;
-                  if (block == 0)
-                        {
-                          
-                          vector<int>::const_iterator it_state_equ = find(state_equ.begin(), state_equ.end(), getBlockEquationID(block, i)+1);
-                          if (it_state_equ != state_equ.end())
-                            {
-                              cout << "row_state_var_incidence[make_pair([" << *it_state_equ << "] " << it_state_equ - state_equ.begin() << ", [" << *it_state_var << "] " << it_state_var - state_var.begin() << ")] =  1;\n";
-                              row_state_var_incidence.insert(make_pair(it_state_equ - state_equ.begin(), it_state_var - state_var.begin()));
-                            }
-                        }*/
-                  set<pair<int,int> >::const_iterator  row_state_var_incidence_it = row_state_var_incidence.begin();
+                    if (block == 0)
+                    {
+
+                    vector<int>::const_iterator it_state_equ = find(state_equ.begin(), state_equ.end(), getBlockEquationID(block, i)+1);
+                    if (it_state_equ != state_equ.end())
+                    {
+                    cout << "row_state_var_incidence[make_pair([" << *it_state_equ << "] " << it_state_equ - state_equ.begin() << ", [" << *it_state_var << "] " << it_state_var - state_var.begin() << ")] =  1;\n";
+                    row_state_var_incidence.insert(make_pair(it_state_equ - state_equ.begin(), it_state_var - state_var.begin()));
+                    }
+                    }*/
+                  set<pair<int, int> >::const_iterator  row_state_var_incidence_it = row_state_var_incidence.begin();
                   bool diag = true;
                   int nb_diag_r = 0;
                   while (row_state_var_incidence_it != row_state_var_incidence.end() && diag)
@@ -3044,12 +3043,12 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
                           if (equ != row_state_var_incidence_it->first)
                             nb_diag_r++;
                         }
-                        
+
                     }
-                  set<pair<int,int> >  col_state_var_incidence;
-                  for(set<pair<int,int> >::const_iterator row_state_var_incidence_it = row_state_var_incidence.begin();row_state_var_incidence_it != row_state_var_incidence.end(); row_state_var_incidence_it++)
+                  set<pair<int, int> >  col_state_var_incidence;
+                  for (set<pair<int, int> >::const_iterator row_state_var_incidence_it = row_state_var_incidence.begin(); row_state_var_incidence_it != row_state_var_incidence.end(); row_state_var_incidence_it++)
                     col_state_var_incidence.insert(make_pair(row_state_var_incidence_it->second, row_state_var_incidence_it->first));
-                  set<pair<int,int> >::const_iterator  col_state_var_incidence_it = col_state_var_incidence.begin();
+                  set<pair<int, int> >::const_iterator  col_state_var_incidence_it = col_state_var_incidence.begin();
                   diag = true;
                   int nb_diag_c = 0;
                   while (col_state_var_incidence_it != col_state_var_incidence.end() && diag)
@@ -3063,13 +3062,13 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
                             nb_diag_c++;
                         }
                     }
-                  nb_diag = min( nb_diag_r, nb_diag_c);
+                  nb_diag = min(nb_diag_r, nb_diag_c);
                   row_state_var_incidence.clear();
                   col_state_var_incidence.clear();
                 }
               for (int i = 0; i < nze; i++)
-                i_nz_state_var[lp + i] = lp + nze; 
-              lp += nze; 
+                i_nz_state_var[lp + i] = lp + nze;
+              lp += nze;
             }
           output << modstruct << "nz_state_var = [";
           for (unsigned int i = 0; i < lp; i++)
@@ -3077,8 +3076,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
           output << "];" << endl;
           output << modstruct << "n_diag = " << nb_diag << ";" << endl;
           KF_index_file.write(reinterpret_cast<char *>(&nb_diag), sizeof(nb_diag));
-          
-          
+
           typedef pair<int, pair<int, int > > index_KF;
           vector<index_KF> v_index_KF;
           for (int i = 0; i < n; i++)
@@ -3086,7 +3084,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
             for (int j = n_obs; j < n; j++)
               {
                 int j1 = j - n_obs;
-                int j1_n_state = j1 * n_state - n_obs ;
+                int j1_n_state = j1 * n_state - n_obs;
                 if ((i < n_obs) || (i >= nb_diag + n_obs) || (j1 >= nb_diag))
                   for (int k = n_obs; k < i_nz_state_var[i]; k++)
                     {
@@ -3095,14 +3093,14 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
               }
           int size_v_index_KF = v_index_KF.size();
 
-          KF_index_file.write(reinterpret_cast<char *>(&size_v_index_KF), sizeof(size_v_index_KF));      
+          KF_index_file.write(reinterpret_cast<char *>(&size_v_index_KF), sizeof(size_v_index_KF));
           for (vector<index_KF>::iterator it = v_index_KF.begin(); it != v_index_KF.end(); it++)
             KF_index_file.write(reinterpret_cast<char *>(&(*it)), sizeof(index_KF));
 
           vector<index_KF> v_index_KF_2;
           int n_n_obs = n * n_obs;
           for (int i = 0; i < n; i++)
-          //i = 0;
+            //i = 0;
             for (int j = i; j < n; j++)
               {
                 if ((i < n_obs) || (i >= nb_diag + n_obs) || (j < n_obs) || (j >= nb_diag + n_obs))
@@ -3114,16 +3112,16 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
               }
           int size_v_index_KF_2 = v_index_KF_2.size();
 
-          KF_index_file.write(reinterpret_cast<char *>(&size_v_index_KF_2), sizeof(size_v_index_KF_2));      
+          KF_index_file.write(reinterpret_cast<char *>(&size_v_index_KF_2), sizeof(size_v_index_KF_2));
           for (vector<index_KF>::iterator it = v_index_KF_2.begin(); it != v_index_KF_2.end(); it++)
-            KF_index_file.write(reinterpret_cast<char *>(&(*it)), sizeof(index_KF));      
+            KF_index_file.write(reinterpret_cast<char *>(&(*it)), sizeof(index_KF));
           KF_index_file.close();
         }
-        output << modstruct << "state_var = [";
+      output << modstruct << "state_var = [";
 
-        for (vector<int>::const_iterator it=state_var.begin(); it != state_var.end(); it++)
-          output << *it << " ";
-        output << "];" << endl;
+      for (vector<int>::const_iterator it = state_var.begin(); it != state_var.end(); it++)
+        output << *it << " ";
+      output << "];" << endl;
     }
 
   // Writing initialization for some other variables
@@ -3137,21 +3135,21 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
 
   output << modstruct << "maximum_endo_lag = " << max_endo_lag << ";" << endl
          << modstruct << "maximum_endo_lead = " << max_endo_lead << ";" << endl
-         << outstruct << "steady_state = zeros(" << symbol_table.endo_nbr() << (julia ? ")" : ", 1);" ) << endl;
+         << outstruct << "steady_state = zeros(" << symbol_table.endo_nbr() << (julia ? ")" : ", 1);") << endl;
 
   output << modstruct << "maximum_exo_lag = " << max_exo_lag << ";" << endl
          << modstruct << "maximum_exo_lead = " << max_exo_lead << ";" << endl
-         << outstruct << "exo_steady_state = zeros(" << symbol_table.exo_nbr() <<  (julia ? ")" : ", 1);" )   << endl;
+         << outstruct << "exo_steady_state = zeros(" << symbol_table.exo_nbr() <<  (julia ? ")" : ", 1);")   << endl;
 
   if (symbol_table.exo_det_nbr())
     {
       output << modstruct << "maximum_exo_det_lag = " << max_exo_det_lag << ";" << endl
              << modstruct << "maximum_exo_det_lead = " << max_exo_det_lead << ";" << endl
-             << outstruct << "exo_det_steady_state = zeros(" << symbol_table.exo_det_nbr() << (julia ? ")" : ", 1);" ) << endl;
+             << outstruct << "exo_det_steady_state = zeros(" << symbol_table.exo_det_nbr() << (julia ? ")" : ", 1);") << endl;
     }
 
   output << modstruct << "params = " << (julia ? "fill(NaN, " : "NaN(")
-         << symbol_table.param_nbr() << (julia ? ")" : ", 1);" ) << endl;
+         << symbol_table.param_nbr() << (julia ? ")" : ", 1);") << endl;
 
   if (compute_xrefs)
     writeXrefs(output);
@@ -3159,7 +3157,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
   // Write number of non-zero derivatives
   // Use -1 if the derivatives have not been computed
   output << modstruct << (julia ? "nnzderivatives" : "NNZDerivatives")
-                          << " = [" << NNZDerivatives[0] << "; ";
+         << " = [" << NNZDerivatives[0] << "; ";
   if (order > 1)
     output << NNZDerivatives[1] << "; ";
   else
@@ -3210,7 +3208,7 @@ DynamicModel::addEquationsForVar(map<string, pair<SymbolList, int> > var_model_i
   // List of endogenous variables and the minimum lag value that must exist in the model equations
   map<string, int> var_endos_and_lags, model_endos_and_lags;
   for (map<string, pair<SymbolList, int> >::const_iterator it = var_model_info.begin();
-      it != var_model_info.end(); it++)
+       it != var_model_info.end(); it++)
     for (size_t i = 0; i < equations.size(); i++)
       if (equations[i]->isVarModelReferenced(it->first))
         {
@@ -3264,7 +3262,7 @@ DynamicModel::computingPass(bool jacobianExo, bool hessian, bool thirdDerivative
   assert(jacobianExo || !(hessian || thirdDerivatives || paramsDerivsOrder));
 
   initializeVariablesAndEquations();
-  
+
   // Prepare for derivation
   computeDerivIDs();
 
@@ -3627,7 +3625,7 @@ DynamicModel::collect_block_first_order_derivatives()
       int var = symbol_table.getTypeSpecificID(getSymbIDByDerivID(it2->first.second));
       int lag = getLagByDerivID(it2->first.second);
       int block_eq = equation_2_block[eq];
-      int block_var=0;
+      int block_var = 0;
       derivative_t tmp_derivative;
       lag_var_t lag_var;
       switch (getTypeByDerivID(it2->first.second))
@@ -4579,7 +4577,6 @@ DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model
       equations[i] = substeq;
     }
 
-
   // Substitute in aux_equations
   // Without this loop, the auxiliary equations in equations
   // will diverge from those in aux_equations
@@ -4779,7 +4776,7 @@ DynamicModel::fillEvalContext(eval_context_t &eval_context) const
   vector <int> trendVars = symbol_table.getTrendVarIds();
   for (vector <int>::const_iterator it = trendVars.begin();
        it != trendVars.end(); it++)
-    eval_context[*it] = 2;  //not <= 0 bc of log, not 1 bc of powers
+    eval_context[*it] = 2;                               //not <= 0 bc of log, not 1 bc of powers
 }
 
 bool
@@ -4825,7 +4822,7 @@ DynamicModel::dynamicOnlyEquationsNbr() const
 }
 
 #ifndef PRIVATE_BUFFER_SIZE
-#define PRIVATE_BUFFER_SIZE 1024
+# define PRIVATE_BUFFER_SIZE 1024
 #endif
 
 bool
@@ -4886,10 +4883,10 @@ DynamicModel::isChecksumMatching(const string &basename) const
     }
 
   char private_buffer[PRIVATE_BUFFER_SIZE];
-  while(buffer)
+  while (buffer)
     {
-      buffer.get(private_buffer,PRIVATE_BUFFER_SIZE);
-      result.process_bytes(private_buffer,strlen(private_buffer));
+      buffer.get(private_buffer, PRIVATE_BUFFER_SIZE);
+      result.process_bytes(private_buffer, strlen(private_buffer));
     }
 
   bool basename_dir_exists = false;
@@ -4901,8 +4898,8 @@ DynamicModel::isChecksumMatching(const string &basename) const
   if (r < 0)
     if (errno != EEXIST)
       {
-	perror("ERROR");
-	exit(EXIT_FAILURE);
+        perror("ERROR");
+        exit(EXIT_FAILURE);
       }
     else
       basename_dir_exists = true;
@@ -4917,25 +4914,25 @@ DynamicModel::isChecksumMatching(const string &basename) const
     {
       checksum_file.open(filename.c_str(), ios::in | ios::binary);
       if (checksum_file.is_open())
-	{
-	  checksum_file >> old_checksum;
-	  checksum_file.close();
-	}
+        {
+          checksum_file >> old_checksum;
+          checksum_file.close();
+        }
     }
   // write new checksum file if none or different from old checksum
   if (old_checksum != result.checksum())
-	{
-	  checksum_file.open(filename.c_str(), ios::out | ios::binary);
-	  if (!checksum_file.is_open())
-	    {
-	      cerr << "ERROR: Can't open file " << filename << endl;
-	      exit(EXIT_FAILURE);
-	    }
-	  checksum_file << result.checksum();
-	  checksum_file.close();
-	  return false;
-	}
-  
+    {
+      checksum_file.open(filename.c_str(), ios::out | ios::binary);
+      if (!checksum_file.is_open())
+        {
+          cerr << "ERROR: Can't open file " << filename << endl;
+          exit(EXIT_FAILURE);
+        }
+      checksum_file << result.checksum();
+      checksum_file.close();
+      return false;
+    }
+
   return true;
 }
 
@@ -4949,26 +4946,26 @@ DynamicModel::writeCOutput(ostream &output, const string &basename, bool block_d
     {
       // Loop on periods
       for (int lag = 0; lag <= 2; lag++)
-	{
-	  lag_presence[lag] = 1;
+        {
+          lag_presence[lag] = 1;
           try
             {
               getDerivID(symbol_table.getID(eEndogenous, endoID), lag-1);
             }
           catch (UnknownDerivIDException &e)
             {
-	      lag_presence[lag] = 0;
+              lag_presence[lag] = 0;
             }
         }
       if (lag_presence[0] == 1)
-	if (lag_presence[2] == 1)
-	  zeta_mixed.push_back(endoID);
-	else
-	  zeta_back.push_back(endoID);
+        if (lag_presence[2] == 1)
+          zeta_mixed.push_back(endoID);
+        else
+          zeta_back.push_back(endoID);
       else if (lag_presence[2] == 1)
-	zeta_fwrd.push_back(endoID);
+        zeta_fwrd.push_back(endoID);
       else
-	zeta_static.push_back(endoID);
+        zeta_static.push_back(endoID);
 
     }
   output << "size_t nstatic = " << zeta_static.size() << ";" << endl
@@ -4978,8 +4975,8 @@ DynamicModel::writeCOutput(ostream &output, const string &basename, bool block_d
   output << "size_t zeta_static[" << zeta_static.size() << "] = {";
   for (vector<int>::iterator i = zeta_static.begin(); i != zeta_static.end(); ++i)
     {
-      if ( i != zeta_static.begin() )
-	output << ",";
+      if (i != zeta_static.begin())
+        output << ",";
       output << *i;
     }
   output << "};" << endl;
@@ -4987,8 +4984,8 @@ DynamicModel::writeCOutput(ostream &output, const string &basename, bool block_d
   output << "size_t zeta_back[" << zeta_back.size() << "] = {";
   for (vector<int>::iterator i = zeta_back.begin(); i != zeta_back.end(); ++i)
     {
-      if ( i != zeta_back.begin() )
-	output << ",";
+      if (i != zeta_back.begin())
+        output << ",";
       output << *i;
     }
   output << "};" << endl;
@@ -4996,8 +4993,8 @@ DynamicModel::writeCOutput(ostream &output, const string &basename, bool block_d
   output << "size_t zeta_fwrd[" << zeta_fwrd.size() << "] = {";
   for (vector<int>::iterator i = zeta_fwrd.begin(); i != zeta_fwrd.end(); ++i)
     {
-      if ( i != zeta_fwrd.begin() )
-	output << ",";
+      if (i != zeta_fwrd.begin())
+        output << ",";
       output << *i;
     }
   output << "};" << endl;
@@ -5005,8 +5002,8 @@ DynamicModel::writeCOutput(ostream &output, const string &basename, bool block_d
   output << "size_t zeta_mixed[" << zeta_mixed.size() << "] = {";
   for (vector<int>::iterator i = zeta_mixed.begin(); i != zeta_mixed.end(); ++i)
     {
-      if ( i != zeta_mixed.begin() )
-	output << ",";
+      if (i != zeta_mixed.begin())
+        output << ",";
       output << *i;
     }
   output << "};" << endl;
@@ -5026,8 +5023,8 @@ DynamicModel::writeCOutput(ostream &output, const string &basename, bool block_d
       output << NNZDerivatives[0] << "," << NNZDerivatives[1] << "," << NNZDerivatives[2] << "};" << endl;
       break;
     default:
-	cerr << "Order larger than 3 not implemented" << endl;
-	exit(EXIT_FAILURE);
+      cerr << "Order larger than 3 not implemented" << endl;
+      exit(EXIT_FAILURE);
     }
 }
 
@@ -5079,7 +5076,7 @@ DynamicModel::writeResidualsC(const string &basename, bool cuda) const
                     << endl
                     << "  /* Residual equations */" << endl
                     << model_output.str()
-		    << "}" << endl;
+                    << "}" << endl;
 
   writePowerDeriv(mDynamicModelFile);
   writeNormcdf(mDynamicModelFile);
@@ -5191,7 +5188,6 @@ DynamicModel::writeFirstDerivativesC_csr(const string &basename, bool cuda) cons
   // this is always empty here, but needed by d1->writeOutput
   deriv_node_temp_terms_t tef_terms;
 
-
   // Indexing derivatives in column order
   vector<derivative> D;
   for (first_derivatives_t::const_iterator it = first_derivatives.begin();
@@ -5204,35 +5200,35 @@ DynamicModel::writeFirstDerivativesC_csr(const string &basename, bool cuda) cons
       SymbolType type = getTypeByDerivID(dynvar);
       int tsid = symbol_table.getTypeSpecificID(symb_id);
       int col_id;
-      switch(type)
-	{
-	case eEndogenous:
-	  col_id = tsid+(lag+1)*symbol_table.endo_nbr();
-	  break;
-	case eExogenous:
-	  col_id = tsid+3*symbol_table.endo_nbr();
-	  break;
-	case eExogenousDet:
-	  col_id = tsid+3*symbol_table.endo_nbr()+symbol_table.exo_nbr();
-	  break;
-	default:
-	  std::cerr << "This case shouldn't happen" << std::endl;
-	  exit(EXIT_FAILURE);
-	}
-      derivative deriv(col_id + eq*cols_nbr,col_id,eq,it->second);
+      switch (type)
+        {
+        case eEndogenous:
+          col_id = tsid+(lag+1)*symbol_table.endo_nbr();
+          break;
+        case eExogenous:
+          col_id = tsid+3*symbol_table.endo_nbr();
+          break;
+        case eExogenousDet:
+          col_id = tsid+3*symbol_table.endo_nbr()+symbol_table.exo_nbr();
+          break;
+        default:
+          std::cerr << "This case shouldn't happen" << std::endl;
+          exit(EXIT_FAILURE);
+        }
+      derivative deriv(col_id + eq *cols_nbr, col_id, eq, it->second);
       D.push_back(deriv);
     }
-  sort(D.begin(), D.end(), derivative_less_than() );
+  sort(D.begin(), D.end(), derivative_less_than());
 
   // writing sparse Jacobian
   vector<int> row_ptr(equations.size());
-  fill(row_ptr.begin(),row_ptr.end(),0.0);
+  fill(row_ptr.begin(), row_ptr.end(), 0.0);
   int k = 0;
-  for(vector<derivative>::const_iterator it = D.begin(); it != D.end(); ++it)
+  for (vector<derivative>::const_iterator it = D.begin(); it != D.end(); ++it)
     {
       row_ptr[it->row_nbr]++;
       mDynamicModelFile << "col_ptr[" << k << "] "
-			<< "=" << it->col_nbr << ";" << endl;
+                        << "=" << it->col_nbr << ";" << endl;
       mDynamicModelFile << "value[" << k << "] = ";
       // oCstaticModel makes reference to the static variables
       it->value->writeOutput(mDynamicModelFile, oCDynamic2Model, temporary_terms, tef_terms);
@@ -5243,20 +5239,20 @@ DynamicModel::writeFirstDerivativesC_csr(const string &basename, bool cuda) cons
   // row_ptr must point to the relative address of the first element of the row
   int cumsum = 0;
   mDynamicModelFile << "int row_ptr_data[" <<  row_ptr.size() + 1 << "] = { 0";
-  for (vector<int>::iterator it=row_ptr.begin(); it != row_ptr.end(); ++it)
+  for (vector<int>::iterator it = row_ptr.begin(); it != row_ptr.end(); ++it)
     {
       cumsum += *it;
       mDynamicModelFile << ", " << cumsum;
     }
   mDynamicModelFile << "};" << endl
-		    << "int i;" << endl
-		    << "for (i=0; i < " << row_ptr.size() + 1 << "; i++) row_ptr[i] = row_ptr_data[i];" << endl;
+                    << "int i;" << endl
+                    << "for (i=0; i < " << row_ptr.size() + 1 << "; i++) row_ptr[i] = row_ptr_data[i];" << endl;
   mDynamicModelFile << "}" << endl;
 
   mDynamicModelFile.close();
 
 }
-  void
+void
 DynamicModel::writeSecondDerivativesC_csr(const string &basename, bool cuda) const
 {
 
@@ -5312,26 +5308,26 @@ DynamicModel::writeSecondDerivativesC_csr(const string &basename, bool cuda) con
 
       int col_nb = id1 * dynJacobianColsNbr + id2;
 
-      derivative deriv(col_nb + eq*hessianColsNbr,col_nb,eq,it->second);
+      derivative deriv(col_nb + eq *hessianColsNbr, col_nb, eq, it->second);
       D.push_back(deriv);
       if (id1 != id2)
-	{
-	  col_nb = id2 * dynJacobianColsNbr + id1;
-	  derivative deriv(col_nb + eq*hessianColsNbr,col_nb,eq,it->second);
-	  D.push_back(deriv);
-	}
+        {
+          col_nb = id2 * dynJacobianColsNbr + id1;
+          derivative deriv(col_nb + eq *hessianColsNbr, col_nb, eq, it->second);
+          D.push_back(deriv);
+        }
     }
-  sort(D.begin(), D.end(), derivative_less_than() );
+  sort(D.begin(), D.end(), derivative_less_than());
 
   // Writing Hessian
   vector<int> row_ptr(equations.size());
-  fill(row_ptr.begin(),row_ptr.end(),0.0);
+  fill(row_ptr.begin(), row_ptr.end(), 0.0);
   int k = 0;
-  for(vector<derivative>::const_iterator it = D.begin(); it != D.end(); ++it)
+  for (vector<derivative>::const_iterator it = D.begin(); it != D.end(); ++it)
     {
       row_ptr[it->row_nbr]++;
       mDynamicModelFile << "col_ptr[" << k << "] "
-			<< "=" << it->col_nbr << ";" << endl;
+                        << "=" << it->col_nbr << ";" << endl;
       mDynamicModelFile << "value[" << k << "] = ";
       // oCstaticModel makes reference to the static variables
       it->value->writeOutput(mDynamicModelFile, oCStaticModel, temporary_terms, tef_terms);
@@ -5342,7 +5338,7 @@ DynamicModel::writeSecondDerivativesC_csr(const string &basename, bool cuda) con
   // row_ptr must point to the relative address of the first element of the row
   int cumsum = 0;
   mDynamicModelFile << "row_ptr = [ 0";
-  for (vector<int>::iterator it=row_ptr.begin(); it != row_ptr.end(); ++it)
+  for (vector<int>::iterator it = row_ptr.begin(); it != row_ptr.end(); ++it)
     {
       cumsum += *it;
       mDynamicModelFile << ", " << cumsum;
@@ -5415,55 +5411,55 @@ DynamicModel::writeThirdDerivativesC_csr(const string &basename, bool cuda) cons
       vector<long unsigned int>  cols;
       long unsigned int col_nb = id1 * hessianColsNbr + id2 * dynJacobianColsNbr + id3;
       int thirdDColsNbr = hessianColsNbr*dynJacobianColsNbr;
-      derivative deriv(col_nb + eq*thirdDColsNbr,col_nb,eq,it->second);
+      derivative deriv(col_nb + eq *thirdDColsNbr, col_nb, eq, it->second);
       D.push_back(deriv);
       cols.push_back(col_nb);
       col_nb = id1 * hessianColsNbr + id3 * dynJacobianColsNbr + id2;
-      if (find(cols.begin(),cols.end(),col_nb) == cols.end())
-	{
-	  derivative deriv(col_nb + eq*thirdDerivativesColsNbr,col_nb,eq,it->second);
-	  D.push_back(deriv);
-	  cols.push_back(col_nb);
-	}
+      if (find(cols.begin(), cols.end(), col_nb) == cols.end())
+        {
+          derivative deriv(col_nb + eq *thirdDerivativesColsNbr, col_nb, eq, it->second);
+          D.push_back(deriv);
+          cols.push_back(col_nb);
+        }
       col_nb = id2 * hessianColsNbr + id1 * dynJacobianColsNbr + id3;
-      if (find(cols.begin(),cols.end(),col_nb) == cols.end())
-	{
-	  derivative deriv(col_nb + eq*thirdDerivativesColsNbr,col_nb,eq,it->second);
-	  D.push_back(deriv);
-	  cols.push_back(col_nb);
-	}
+      if (find(cols.begin(), cols.end(), col_nb) == cols.end())
+        {
+          derivative deriv(col_nb + eq *thirdDerivativesColsNbr, col_nb, eq, it->second);
+          D.push_back(deriv);
+          cols.push_back(col_nb);
+        }
       col_nb = id2 * hessianColsNbr + id3 * dynJacobianColsNbr + id1;
-      if (find(cols.begin(),cols.end(),col_nb) == cols.end())
-	{
-	  derivative deriv(col_nb + eq*thirdDerivativesColsNbr,col_nb,eq,it->second);
-	  D.push_back(deriv);
-	  cols.push_back(col_nb);
-	}
+      if (find(cols.begin(), cols.end(), col_nb) == cols.end())
+        {
+          derivative deriv(col_nb + eq *thirdDerivativesColsNbr, col_nb, eq, it->second);
+          D.push_back(deriv);
+          cols.push_back(col_nb);
+        }
       col_nb = id3 * hessianColsNbr + id1 * dynJacobianColsNbr + id2;
-      if (find(cols.begin(),cols.end(),col_nb) == cols.end())
-	{
-	  derivative deriv(col_nb + eq*thirdDerivativesColsNbr,col_nb,eq,it->second);
-	  D.push_back(deriv);
-	  cols.push_back(col_nb);
-	}
+      if (find(cols.begin(), cols.end(), col_nb) == cols.end())
+        {
+          derivative deriv(col_nb + eq *thirdDerivativesColsNbr, col_nb, eq, it->second);
+          D.push_back(deriv);
+          cols.push_back(col_nb);
+        }
       col_nb = id3 * hessianColsNbr + id2 * dynJacobianColsNbr + id1;
-      if (find(cols.begin(),cols.end(),col_nb) == cols.end())
-	{
-	  derivative deriv(col_nb + eq*thirdDerivativesColsNbr,col_nb,eq,it->second);
-	  D.push_back(deriv);
-	}
+      if (find(cols.begin(), cols.end(), col_nb) == cols.end())
+        {
+          derivative deriv(col_nb + eq *thirdDerivativesColsNbr, col_nb, eq, it->second);
+          D.push_back(deriv);
+        }
     }
 
-  sort(D.begin(), D.end(), derivative_less_than() );
+  sort(D.begin(), D.end(), derivative_less_than());
 
   vector<int> row_ptr(equations.size());
-  fill(row_ptr.begin(),row_ptr.end(),0.0);
+  fill(row_ptr.begin(), row_ptr.end(), 0.0);
   int k = 0;
-  for(vector<derivative>::const_iterator it = D.begin(); it != D.end(); ++it)
+  for (vector<derivative>::const_iterator it = D.begin(); it != D.end(); ++it)
     {
       row_ptr[it->row_nbr]++;
       mDynamicModelFile << "col_ptr[" << k << "] "
-			<< "=" << it->col_nbr << ";" << endl;
+                        << "=" << it->col_nbr << ";" << endl;
       mDynamicModelFile << "value[" << k << "] = ";
       // oCstaticModel makes reference to the static variables
       it->value->writeOutput(mDynamicModelFile, oCStaticModel, temporary_terms, tef_terms);
@@ -5474,7 +5470,7 @@ DynamicModel::writeThirdDerivativesC_csr(const string &basename, bool cuda) cons
   // row_ptr must point to the relative address of the first element of the row
   int cumsum = 0;
   mDynamicModelFile << "row_ptr = [ 0";
-  for (vector<int>::iterator it=row_ptr.begin(); it != row_ptr.end(); ++it)
+  for (vector<int>::iterator it = row_ptr.begin(); it != row_ptr.end(); ++it)
     {
       cumsum += *it;
       mDynamicModelFile << ", " << cumsum;
@@ -5498,26 +5494,26 @@ DynamicModel::writeCCOutput(ostream &output, const string &basename, bool block_
     {
       // Loop on periods
       for (int lag = 0; lag <= 2; lag++)
-	{
-	  lag_presence[lag] = 1;
+        {
+          lag_presence[lag] = 1;
           try
             {
               getDerivID(symbol_table.getID(eEndogenous, endoID), lag-1);
             }
           catch (UnknownDerivIDException &e)
             {
-	      lag_presence[lag] = 0;
+              lag_presence[lag] = 0;
             }
         }
       if (lag_presence[0] == 1)
-	if (lag_presence[2] == 1)
-	  output << "zeta_mixed.push_back(" << endoID << ");" << endl;
-	else
-	  output << "zeta_back.push_back(" << endoID << ");" << endl;
+        if (lag_presence[2] == 1)
+          output << "zeta_mixed.push_back(" << endoID << ");" << endl;
+        else
+          output << "zeta_back.push_back(" << endoID << ");" << endl;
       else if (lag_presence[2] == 1)
-	output << "zeta_fwrd.push_back(" << endoID << ");" << endl;
+        output << "zeta_fwrd.push_back(" << endoID << ");" << endl;
       else
-	output << "zeta_static.push_back(" << endoID << ");" << endl;
+        output << "zeta_static.push_back(" << endoID << ");" << endl;
 
     }
   output << "nstatic = zeta_static.size();" << endl
diff --git a/DynamicModel.hh b/DynamicModel.hh
index e2d937bf4ac0749fd2d83155fcfe2f6ea6edd54c..62443cf437a96552383fc7628f5963225992f703 100644
--- a/DynamicModel.hh
+++ b/DynamicModel.hh
@@ -283,7 +283,7 @@ public:
 
   //! Returns number of static only equations
   size_t staticOnlyEquationsNbr() const;
-  
+
   //! Returns number of dynamic only equations
   size_t dynamicOnlyEquationsNbr() const;
 
@@ -341,7 +341,7 @@ public:
 
   //! Transforms the model by creating aux vars for the diff of forward vars
   /*! If subset is empty, does the transformation for all fwrd vars; otherwise
-      restrict it to the vars in subset */
+    restrict it to the vars in subset */
   void differentiateForwardVars(const vector<string> &subset);
 
   //! Fills eval context with values of model local variables and auxiliary variables
@@ -539,7 +539,7 @@ DynamicModel::checkHessianZero() const
   return second_derivatives.empty();
 }
 
-//! Classes to re-order derivatives for various sparse storage formats 
+//! Classes to re-order derivatives for various sparse storage formats
 class derivative
 {
 public:
@@ -547,14 +547,17 @@ public:
   long unsigned int col_nbr;
   unsigned int row_nbr;
   expr_t value;
-  derivative(long unsigned int arg1, long unsigned int arg2, int arg3, expr_t arg4):
-    linear_address(arg1), col_nbr(arg2), row_nbr(arg3), value(arg4) {};
+  derivative(long unsigned int arg1, long unsigned int arg2, int arg3, expr_t arg4) :
+    linear_address(arg1), col_nbr(arg2), row_nbr(arg3), value(arg4)
+  {
+  };
 };
 
 class derivative_less_than
 {
 public:
-  bool operator()(const derivative & d1, const derivative & d2) const
+  bool
+  operator()(const derivative &d1, const derivative &d2) const
   {
     return d1.linear_address < d2.linear_address;
   }
diff --git a/DynareMain.cc b/DynareMain.cc
index adbb1b6821f2afdcc799949a6f99d16d1699406a..51fa776725c3d452d6303c7d5a66435a6ceba9d6 100644
--- a/DynareMain.cc
+++ b/DynareMain.cc
@@ -124,8 +124,8 @@ main(int argc, char **argv)
         clear_all = false;
       else if (strlen(argv[arg]) >= 19 && !strncmp(argv[arg], "params_derivs_order", 19))
         {
-          if (strlen(argv[arg]) >= 22 || argv[arg][19] != '=' ||
-              !(argv[arg][20] == '0' || argv[arg][20] == '1' || argv[arg][20] == '2'))
+          if (strlen(argv[arg]) >= 22 || argv[arg][19] != '='
+              || !(argv[arg][20] == '0' || argv[arg][20] == '1' || argv[arg][20] == '2'))
             {
               cerr << "Incorrect syntax for params_derivs_order option" << endl;
               usage();
@@ -222,12 +222,12 @@ main(int argc, char **argv)
           size_t equal_index = string(argv[arg]).find('=');
           if (equal_index != string::npos)
             {
-              string key = string(argv[arg]).erase(equal_index).erase(0,2);
+              string key = string(argv[arg]).erase(equal_index).erase(0, 2);
               defines[key] = string(argv[arg]).erase(0, equal_index+1);
             }
           else
             {
-              string key = string(argv[arg]).erase(0,2);
+              string key = string(argv[arg]).erase(0, 2);
               defines[key] = "1";
             }
         }
@@ -239,36 +239,36 @@ main(int argc, char **argv)
                    << "must not be separated from -I by whitespace." << endl;
               usage();
             }
-          path.push_back(string(argv[arg]).erase(0,2));
+          path.push_back(string(argv[arg]).erase(0, 2));
         }
       else if (strlen(argv[arg]) >= 6 && !strncmp(argv[arg], "output", 6))
         {
-	  if (strlen(argv[arg]) <= 7 || argv[arg][6] != '=')
-	    {
-	      cerr << "Incorrect syntax for ouput option" << endl;
-	      usage();
-	    }
-	  if (strlen(argv[arg]) == 14 && !strncmp(argv[arg] + 7, "dynamic", 7))
-	    output_mode = dynamic;
-	  else if (strlen(argv[arg]) ==  12 && !strncmp(argv[arg] + 7, "first", 5))
-	    output_mode = first;
-	  else if (strlen(argv[arg]) == 13 && !strncmp(argv[arg] + 7, "second", 6))
-	    output_mode = second;
-	  else if (strlen(argv[arg]) == 12 && !strncmp(argv[arg] + 7, "third", 5))
-	    output_mode = third;
-	  else
-	    {
-	      cerr << "Incorrect syntax for ouput option" << endl;
-	      usage();
+          if (strlen(argv[arg]) <= 7 || argv[arg][6] != '=')
+            {
+              cerr << "Incorrect syntax for ouput option" << endl;
+              usage();
+            }
+          if (strlen(argv[arg]) == 14 && !strncmp(argv[arg] + 7, "dynamic", 7))
+            output_mode = dynamic;
+          else if (strlen(argv[arg]) ==  12 && !strncmp(argv[arg] + 7, "first", 5))
+            output_mode = first;
+          else if (strlen(argv[arg]) == 13 && !strncmp(argv[arg] + 7, "second", 6))
+            output_mode = second;
+          else if (strlen(argv[arg]) == 12 && !strncmp(argv[arg] + 7, "third", 5))
+            output_mode = third;
+          else
+            {
+              cerr << "Incorrect syntax for ouput option" << endl;
+              usage();
             }
         }
       else if (strlen(argv[arg]) >= 8 && !strncmp(argv[arg], "language", 8))
         {
-	  if (strlen(argv[arg]) <= 9 || argv[arg][8] != '=')
-	    {
-	      cerr << "Incorrect syntax for language option" << endl;
-	      usage();
-	    }
+          if (strlen(argv[arg]) <= 9 || argv[arg][8] != '=')
+            {
+              cerr << "Incorrect syntax for language option" << endl;
+              usage();
+            }
 
           if (strlen(argv[arg]) == 14 && !strncmp(argv[arg] + 9, "julia", 5))
             language = julia;
diff --git a/DynareMain2.cc b/DynareMain2.cc
index b5d1e00646207f775e407cf34b1d7e28634376e2..dc9420ca0a6a12f6b6b1f709cc173847ccc91d76 100644
--- a/DynareMain2.cc
+++ b/DynareMain2.cc
@@ -60,9 +60,9 @@ main2(stringstream &in, string &basename, bool debug, bool clear_all, bool clear
     mod_file->writeOutputFiles(basename, clear_all, clear_global, no_log, no_warn, console, nograph,
                                nointeractive, config_file, check_model_changes, minimal_workspace, compute_xrefs
 #if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__)
-			       , cygwin, msvc, mingw
+                               , cygwin, msvc, mingw
 #endif
-			       );
+                               );
 
   delete mod_file;
 
diff --git a/ExprNode.cc b/ExprNode.cc
index c6194ead5214bd2bd93ec022a641a76fd94dc476..e738f7fd4e52a01985d845bafefb9107991473c8 100644
--- a/ExprNode.cc
+++ b/ExprNode.cc
@@ -100,7 +100,7 @@ ExprNode::collectVariables(SymbolType type, set<int> &result) const
   set<pair<int, int> > symbs_lags;
   collectDynamicVariables(type, symbs_lags);
   transform(symbs_lags.begin(), symbs_lags.end(), inserter(result, result.begin()),
-            boost::bind(&pair<int,int>::first,_1));
+            boost::bind(&pair<int, int>::first, _1));
 }
 
 void
@@ -535,7 +535,6 @@ NumConstNode::substituteStaticAuxiliaryVariable() const
   return const_cast<NumConstNode *>(this);
 }
 
-
 VariableNode::VariableNode(DataTree &datatree_arg, int symb_id_arg, int lag_arg) :
   ExprNode(datatree_arg),
   symb_id(symb_id_arg),
@@ -888,7 +887,7 @@ VariableNode::substituteStaticAuxiliaryVariable() const
     }
   return const_cast<VariableNode *>(this);
 }
-  
+
 double
 VariableNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException)
 {
@@ -997,17 +996,17 @@ VariableNode::collectDynamicVariables(SymbolType type_arg, set<pair<int, int> >
 pair<int, expr_t>
 VariableNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr_t> > > &List_of_Op_RHS) const
 {
-  /* The equation has to be normalized with respect to the current endogenous variable ascribed to it. 
-     The two input arguments are : 
-        - The ID of the endogenous variable associated to the equation.
-        - The list of operators and operands needed to normalize the equation*
-        
-     The pair returned by NormalizeEquation is composed of 
-      - a flag indicating if the expression returned contains (flag = 1) or not (flag = 0) 
-        the endogenous variable related to the equation.
-        If the expression contains more than one occurence of the associated endogenous variable, 
-        the flag is equal to 2. 
-      - an expression equal to the RHS if flag = 0 and equal to NULL elsewhere
+  /* The equation has to be normalized with respect to the current endogenous variable ascribed to it.
+     The two input arguments are :
+     - The ID of the endogenous variable associated to the equation.
+     - The list of operators and operands needed to normalize the equation*
+
+     The pair returned by NormalizeEquation is composed of
+     - a flag indicating if the expression returned contains (flag = 1) or not (flag = 0)
+     the endogenous variable related to the equation.
+     If the expression contains more than one occurence of the associated endogenous variable,
+     the flag is equal to 2.
+     - an expression equal to the RHS if flag = 0 and equal to NULL elsewhere
   */
   if (type == eEndogenous)
     {
@@ -1487,7 +1486,7 @@ VariableNode::removeTrendLeadLag(map<int, expr_t> trend_symbols_map) const
   expr_t noTrendLeadLagNode = new VariableNode(datatree, it->first, 0);
   bool log_trend = get_type() == eLogTrend;
   expr_t trend = it->second;
-  
+
   if (get_lag() > 0)
     {
       expr_t growthFactorSequence = trend->decreaseLeadsLags(-1);
@@ -2213,9 +2212,9 @@ UnaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr_
 
   if (is_endogenous_present == 2) /* The equation could not be normalized and the process is given-up*/
     return (make_pair(2, (expr_t) NULL));
-  else if (is_endogenous_present) /* The argument of the function contains the current values of 
-                                     the endogenous variable associated to the equation. 
-                                     In order to normalized, we have to apply the invert function to the RHS.*/ 
+  else if (is_endogenous_present) /* The argument of the function contains the current values of
+                                     the endogenous variable associated to the equation.
+                                     In order to normalized, we have to apply the invert function to the RHS.*/
     {
       switch (op_code)
         {
@@ -2284,7 +2283,7 @@ UnaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr_
         }
     }
   else
-    { /* If the argument of the function do not contain the current values of the endogenous variable 
+    { /* If the argument of the function do not contain the current values of the endogenous variable
          related to the equation, the function with its argument is stored in the RHS*/
       switch (op_code)
         {
@@ -2521,7 +2520,7 @@ UnaryOpNode::substituteExoLag(subst_table_t &subst_table, vector<BinaryOpNode *>
 expr_t
 UnaryOpNode::substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const
 {
-  if (op_code==oExpectation)
+  if (op_code == oExpectation)
     {
       subst_table_t::iterator it = subst_table.find(const_cast<UnaryOpNode *>(this));
       if (it != subst_table.end())
@@ -3401,7 +3400,7 @@ BinaryOpNode::Compute_RHS(expr_t arg1, expr_t arg2, int op, int op_type) const
 pair<int, expr_t>
 BinaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr_t> > > &List_of_Op_RHS) const
 {
-  /* Checks if the current value of the endogenous variable related to the equation 
+  /* Checks if the current value of the endogenous variable related to the equation
      is present in the arguments of the binary operator. */
   vector<pair<int, pair<expr_t, expr_t> > > List_of_Op_RHS1, List_of_Op_RHS2;
   int is_endogenous_present_1, is_endogenous_present_2;
@@ -3414,17 +3413,17 @@ BinaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr
   res = arg2->normalizeEquation(var_endo, List_of_Op_RHS2);
   is_endogenous_present_2 = res.first;
   expr_t_2 = res.second;
-  
+
   /* If the two expressions contains the current value of the endogenous variable associated to the equation
      the equation could not be normalized and the process is given-up.*/
   if (is_endogenous_present_1 == 2 || is_endogenous_present_2 == 2)
     return (make_pair(2, (expr_t) NULL));
   else if (is_endogenous_present_1 && is_endogenous_present_2)
     return (make_pair(2, (expr_t) NULL));
-  else if (is_endogenous_present_1) /*If the current values of the endogenous variable associated to the equation 
+  else if (is_endogenous_present_1) /*If the current values of the endogenous variable associated to the equation
                                       is present only in the first operand of the expression, we try to normalize the equation*/
     {
-      if (op_code == oEqual)       /* The end of the normalization process : 
+      if (op_code == oEqual)       /* The end of the normalization process :
                                       All the operations needed to normalize the equation are applied. */
         {
           pair<int, pair<expr_t, expr_t> > it;
@@ -3439,7 +3438,7 @@ BinaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr
                 expr_t_2 = Compute_RHS(it.second.second, expr_t_2, it.first, 1);
               else if (it.second.second && it.second.first) /*Binary operator*/
                 expr_t_2 = Compute_RHS(it.second.first, it.second.second, it.first, 1);
-              else                                                             /*Unary operator*/
+              else                                                                                 /*Unary operator*/
                 expr_t_2 = Compute_RHS((UnaryOpNode *) expr_t_2, (UnaryOpNode *) it.second.first, it.first, 0);
             }
         }
@@ -3872,7 +3871,6 @@ BinaryOpNode::substituteExpectation(subst_table_t &subst_table, vector<BinaryOpN
   return buildSimilarBinaryOpNode(arg1subst, arg2subst, datatree);
 }
 
-
 expr_t
 BinaryOpNode::differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
 {
@@ -4569,7 +4567,6 @@ TrinaryOpNode::substituteExpectation(subst_table_t &subst_table, vector<BinaryOp
   return buildSimilarTrinaryOpNode(arg1subst, arg2subst, arg3subst, datatree);
 }
 
-
 expr_t
 TrinaryOpNode::differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const
 {
@@ -5933,11 +5930,11 @@ VarExpectationNode::computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReferenc
 
 void
 VarExpectationNode::computeTemporaryTerms(map<expr_t, int> &reference_count,
-                                                       temporary_terms_t &temporary_terms,
-                                                       map<expr_t, pair<int, int> > &first_occurence,
-                                                       int Curr_block,
-                                                       vector< vector<temporary_terms_t> > &v_temporary_terms,
-                                                       int equation) const
+                                          temporary_terms_t &temporary_terms,
+                                          map<expr_t, pair<int, int> > &first_occurence,
+                                          int Curr_block,
+                                          vector< vector<temporary_terms_t> > &v_temporary_terms,
+                                          int equation) const
 {
   expr_t this2 = const_cast<VarExpectationNode *>(this);
   temporary_terms.insert(this2);
@@ -6077,9 +6074,9 @@ VarExpectationNode::collectTemporary_terms(const temporary_terms_t &temporary_te
 
 void
 VarExpectationNode::compile(ostream &CompileCode, unsigned int &instruction_number,
-                      bool lhs_rhs, const temporary_terms_t &temporary_terms,
-                      const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
-                      deriv_node_temp_terms_t &tef_terms) const
+                            bool lhs_rhs, const temporary_terms_t &temporary_terms,
+                            const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
+                            deriv_node_temp_terms_t &tef_terms) const
 {
   cerr << "VarExpectationNode::compile not implemented." << endl;
   exit(EXIT_FAILURE);
diff --git a/ExprNode.hh b/ExprNode.hh
index cc566b7841b6852860a1020d6f729b9f16b73df5..ca6cbeb7efb4183a3eed99e5f9a14f94e3ecbfa3 100644
--- a/ExprNode.hh
+++ b/ExprNode.hh
@@ -90,16 +90,16 @@ enum ExprNodeOutputType
                                 || (output_type) == oMatlabDynamicSparseSteadyStateOperator \
                                 || (output_type) == oSteadyStateFile)
 
-#define IS_JULIA(output_type) ((output_type) == oJuliaStaticModel     \
-                               || (output_type) == oJuliaDynamicModel  \
+#define IS_JULIA(output_type) ((output_type) == oJuliaStaticModel       \
+                               || (output_type) == oJuliaDynamicModel   \
                                || (output_type) == oJuliaDynamicSteadyStateOperator \
                                || (output_type) == oJuliaSteadyStateFile)
 
-#define IS_C(output_type) ((output_type) == oCDynamicModel \
-			   || (output_type) == oCDynamic2Model \
-			   || (output_type) == oCStaticModel \
-			   || (output_type) == oCDynamicSteadyStateOperator \
-			   || (output_type) == oCSteadyStateFile)
+#define IS_C(output_type) ((output_type) == oCDynamicModel              \
+                           || (output_type) == oCDynamic2Model          \
+                           || (output_type) == oCStaticModel            \
+                           || (output_type) == oCDynamicSteadyStateOperator \
+                           || (output_type) == oCSteadyStateFile)
 
 #define IS_LATEX(output_type) ((output_type) == oLatexStaticModel       \
                                || (output_type) == oLatexDynamicModel   \
@@ -123,344 +123,345 @@ enum ExprNodeOutputType
 #define MIN_COST(is_matlab) ((is_matlab) ? MIN_COST_MATLAB : MIN_COST_C)
 
 //! Base class for expression nodes
-class ExprNode
-{
-  friend class DataTree;
-  friend class DynamicModel;
-  friend class StaticModel;
-  friend class ModelTree;
-  friend struct ExprNodeLess;
-  friend class NumConstNode;
-  friend class VariableNode;
-  friend class UnaryOpNode;
-  friend class BinaryOpNode;
-  friend class TrinaryOpNode;
-  friend class AbstractExternalFunctionNode;
-  friend class VarExpectationNode;
-private:
-  //! Computes derivative w.r. to a derivation ID (but doesn't store it in derivatives map)
-  /*! You shoud use getDerivative() to get the benefit of symbolic a priori and of caching */
-  virtual expr_t computeDerivative(int deriv_id) = 0;
-
-protected:
-  //! Reference to the enclosing DataTree
-  DataTree &datatree;
-
-  //! Index number
-  int idx;
-
-  //! Is the data member non_null_derivatives initialized ?
-  bool preparedForDerivation;
-
-  //! Set of derivation IDs with respect to which the derivative is potentially non-null
-  set<int> non_null_derivatives;
-
-  //! Used for caching of first order derivatives (when non-null)
-  map<int, expr_t> derivatives;
-
-  //! Cost of computing current node
-  /*! Nodes included in temporary_terms are considered having a null cost */
-  virtual int cost(int cost, bool is_matlab) const;
-  virtual int cost(const temporary_terms_t &temporary_terms, bool is_matlab) const;
-  virtual int cost(const map<NodeTreeReference, temporary_terms_t> &temp_terms_map, bool is_matlab) const;
-
-  //! For creating equation cross references
-  struct EquationInfo
-  {
-    set<pair<int, int> > param;
-    set<pair<int, int> > endo;
-    set<pair<int, int> > exo;
-    set<pair<int, int> > exo_det;
-  };
-
-public:
-  ExprNode(DataTree &datatree_arg);
-  virtual ~ExprNode();
-
-  //! Initializes data member non_null_derivatives
-  virtual void prepareForDerivation() = 0;
-
-  //! Returns derivative w.r. to derivation ID
-  /*! Uses a symbolic a priori to pre-detect null derivatives, and caches the result for other derivatives (to avoid computing it several times)
-    For an equal node, returns the derivative of lhs minus rhs */
-  expr_t getDerivative(int deriv_id);
-
-  //! Computes derivatives by applying the chain rule for some variables
-  /*!
-    \param deriv_id The derivation ID with respect to which we are derivating
-    \param recursive_variables Contains the derivation ID for which chain rules must be applied. Keys are derivation IDs, values are equations of the form x=f(y) where x is the key variable and x doesn't appear in y
-  */
-  virtual expr_t getChainRuleDerivative(int deriv_id, const map<int, expr_t> &recursive_variables) = 0;
-
-  //! Returns precedence of node
-  /*! Equals 100 for constants, variables, unary ops, and temporary terms */
-  virtual int precedence(ExprNodeOutputType output_t, const temporary_terms_t &temporary_terms) const;
-
-  //! Fills temporary_terms set, using reference counts
-  /*! A node will be marked as a temporary term if it is referenced at least two times (i.e. has at least two parents), and has a computing cost (multiplied by reference count) greater to datatree.min_cost */
-  virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
-                                     map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
-                                     bool is_matlab, NodeTreeReference tr) const;
-
-  //! Writes output of node, using a Txxx notation for nodes in temporary_terms, and specifiying the set of already written external functions
-  /*!
-    \param[in] output the output stream
-    \param[in] output_type the type of output (MATLAB, C, LaTeX...)
-    \param[in] temporary_terms the nodes that are marked as temporary terms
-    \param[in,out] tef_terms the set of already written external function nodes
-  */
-  virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const = 0;
-
-  //! returns true if the expr node contains an external function
-  virtual bool containsExternalFunction() const = 0;
-
-  //! Writes output of node (with no temporary terms and with "outside model" output type)
-  void writeOutput(ostream &output) const;
-
-  //! Writes output of node (with no temporary terms)
-  void writeOutput(ostream &output, ExprNodeOutputType output_type) const;
-
-  //! Writes output of node, using a Txxx notation for nodes in temporary_terms
-  void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms) const;
-
-  //! Writes the output for an external function, ensuring that the external function is called as few times as possible using temporary terms
-  virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
-                                           const temporary_terms_t &temporary_terms,
-                                           deriv_node_temp_terms_t &tef_terms) const;
-
-  virtual void compileExternalFunctionOutput(ostream &CompileCode, unsigned int &instruction_number,
-                                             bool lhs_rhs, const temporary_terms_t &temporary_terms,
-                                             const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
-                                             deriv_node_temp_terms_t &tef_terms) const;
-
-  //! Computes the set of all variables of a given symbol type in the expression (with information on lags)
-  /*!
-    Variables are stored as integer pairs of the form (symb_id, lag).
-    They are added to the set given in argument.
-    Note that model local variables are substituted by their expression in the computation
-    (and added if type_arg = ModelLocalVariable).
-  */
-  virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const = 0;
-
-  //! Computes the set of all variables of a given symbol type in the expression (without information on lags)
-  /*!
-    Variables are stored as symb_id.
-    They are added to the set given in argument.
-    Note that model local variables are substituted by their expression in the computation
-    (and added if type_arg = ModelLocalVariable).
-  */
-  void collectVariables(SymbolType type_arg, set<int> &result) const;
-
-  //! Computes the set of endogenous variables in the expression
-  /*!
-    Endogenous are stored as integer pairs of the form (type_specific_id, lag).
-    They are added to the set given in argument.
-    Note that model local variables are substituted by their expression in the computation.
-  */
-  virtual void collectEndogenous(set<pair<int, int> > &result) const;
-
-  //! Computes the set of exogenous variables in the expression
-  /*!
-    Exogenous are stored as integer pairs of the form (type_specific_id, lag).
-    They are added to the set given in argument.
-    Note that model local variables are substituted by their expression in the computation.
-  */
-  virtual void collectExogenous(set<pair<int, int> > &result) const;
-
-  virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const = 0;
-
-  virtual void computeTemporaryTerms(map<expr_t, int> &reference_count,
-                                     temporary_terms_t &temporary_terms,
-                                     map<expr_t, pair<int, int> > &first_occurence,
-                                     int Curr_block,
-                                     vector< vector<temporary_terms_t> > &v_temporary_terms,
-                                     int equation) const;
-
-  class EvalException
-
-  {
-  };
-
-  class EvalExternalFunctionException : public EvalException
-
-  {
-  };
-
-  virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) = 0;
-  virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const = 0;
-  void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic) const;
-  //! Creates a static version of this node
-  /*!
-    This method duplicates the current node by creating a similar node from which all leads/lags have been stripped,
-    adds the result in the static_datatree argument (and not in the original datatree), and returns it.
-  */
-  virtual expr_t toStatic(DataTree &static_datatree) const = 0;
-
-  /*!
-    Compute cross references for equations
-   */
-  //  virtual void computeXrefs(set<int> &param, set<int> &endo, set<int> &exo, set<int> &exo_det) const = 0;
-  virtual void computeXrefs(EquationInfo &ei) const = 0;
-  //! Try to normalize an equation linear in its endogenous variable
-  virtual pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t> > > &List_of_Op_RHS) const = 0;
-
-  //! Returns the maximum lead of endogenous in this expression
-  /*! Always returns a non-negative value */
-  virtual int maxEndoLead() const = 0;
-
-  //! Returns the maximum lead of exogenous in this expression
-  /*! Always returns a non-negative value */
-  virtual int maxExoLead() const = 0;
-
-  //! Returns the maximum lag of endogenous in this expression
-  /*! Always returns a non-negative value */
-  virtual int maxEndoLag() const = 0;
-
-  //! Returns the maximum lag of exogenous in this expression
-  /*! Always returns a non-negative value */
-  virtual int maxExoLag() const = 0;
-
-  //! Returns the relative period of the most forward term in this expression
-  /*! A negative value means that the expression contains only lagged variables */
-  virtual int maxLead() const = 0;
-
-  //! Returns a new expression where all the leads/lags have been shifted backwards by the same amount
-  /*!
-    Only acts on endogenous, exogenous, exogenous det
-    \param[in] n The number of lags by which to shift
-    \return The same expression except that leads/lags have been shifted backwards
-  */
-  virtual expr_t decreaseLeadsLags(int n) const = 0;
-
-  //! Type for the substitution map used in the process of creating auxiliary vars for leads >= 2
-  typedef map<const ExprNode *, const VariableNode *> subst_table_t;
-
-  //! Creates auxiliary endo lead variables corresponding to this expression
-  /*!
-    If maximum endogenous lead >= 3, this method will also create intermediary auxiliary var, and will add the equations of the form aux1 = aux2(+1) to the substitution table.
-    \pre This expression is assumed to have maximum endogenous lead >= 2
-    \param[in,out] subst_table The table to which new auxiliary variables and their correspondance will be added
-    \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
-    \return The new variable node corresponding to the current expression
-  */
-  VariableNode *createEndoLeadAuxiliaryVarForMyself(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
-
-  //! Creates auxiliary exo lead variables corresponding to this expression
-  /*!
-    If maximum exogenous lead >= 2, this method will also create intermediary auxiliary var, and will add the equations of the form aux1 = aux2(+1) to the substitution table.
-    \pre This expression is assumed to have maximum exogenous lead >= 1
-    \param[in,out] subst_table The table to which new auxiliary variables and their correspondance will be added
-    \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
-    \return The new variable node corresponding to the current expression
-  */
-  VariableNode *createExoLeadAuxiliaryVarForMyself(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
-
-  //! Constructs a new expression where sub-expressions with max endo lead >= 2 have been replaced by auxiliary variables
-  /*!
-    \param[in,out] subst_table Map used to store expressions that have already be substituted and their corresponding variable, in order to avoid creating two auxiliary variables for the same sub-expr.
-    \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
-
-    If the method detects a sub-expr which needs to be substituted, two cases are possible:
-    - if this expr is in the table, then it will use the corresponding variable and return the substituted expression
-    - if this expr is not in the table, then it will create an auxiliary endogenous variable, add the substitution in the table and return the substituted expression
-
-    \return A new equivalent expression where sub-expressions with max endo lead >= 2 have been replaced by auxiliary variables
-  */
-  virtual expr_t substituteEndoLeadGreaterThanTwo(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool deterministic_model) const = 0;
-
-  //! Constructs a new expression where endo variables with max endo lag >= 2 have been replaced by auxiliary variables
-  /*!
-    \param[in,out] subst_table Map used to store expressions that have already be substituted and their corresponding variable, in order to avoid creating two auxiliary variables for the same sub-expr.
-    \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
-  */
-  virtual expr_t substituteEndoLagGreaterThanTwo(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const = 0;
-
-  //! Constructs a new expression where exogenous variables with a lead have been replaced by auxiliary variables
-  /*!
-    \param[in,out] subst_table Map used to store expressions that have already be substituted and their corresponding variable, in order to avoid creating two auxiliary variables for the same sub-expr.
-    \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
-  */
-  virtual expr_t substituteExoLead(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool deterministic_model) const = 0;
-  //! Constructs a new expression where exogenous variables with a lag have been replaced by auxiliary variables
-  /*!
-    \param[in,out] subst_table Map used to store expressions that have already be substituted and their corresponding variable, in order to avoid creating two auxiliary variables for the same sub-expr.
-    \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
-  */
-  virtual expr_t substituteExoLag(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const = 0;
-
-  //! Constructs a new expression where the expectation operator has been replaced by auxiliary variables
-  /*!
-    \param[in,out] subst_table Map used to store expressions that have already be substituted and their corresponding variable, in order to avoid creating two auxiliary variables for the same sub-expr.
-    \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
-    \param[in] partial_information_model Are we substituting in a partial information model?
-  */
-  virtual expr_t substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const = 0;
-
-  virtual expr_t decreaseLeadsLagsPredeterminedVariables() const = 0;
-
-  //! Constructs a new expression where forward variables (supposed to be at most in t+1) have been replaced by themselves at t, plus a new aux var representing their (time) differentiate
-  /*!
-    \param[in] subset variables to which to limit the transformation; transform
-    all fwrd vars if empty
-    \param[in,out] subst_table Map used to store mapping between a given
-    forward variable and the aux var that contains its differentiate
-    \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
-  */
-  virtual expr_t differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const = 0;
-
-  //! Return true if the nodeID is a numerical constant equal to value and false otherwise
-  /*!
-    \param[in] value of the numerical constante
-    \param[out] the boolean equal to true if NodeId is a constant equal to value
-  */
-  virtual bool isNumConstNodeEqualTo(double value) const = 0;
-
-  //! Returns true if the expression contains one or several endogenous variable
-  virtual bool containsEndogenous(void) const = 0;
-
-  //! Returns true if the expression contains one or several exogenous variable
-  virtual bool containsExogenous() const = 0;
-
-  //! Return true if the nodeID is a variable withe a type equal to type_arg, a specific variable id aqual to varfiable_id and a lag equal to lag_arg and false otherwise
-  /*!
-    \param[in] the type (type_arg), specifique variable id (variable_id and the lag (lag_arg)
-    \param[out] the boolean equal to true if NodeId is the variable
-  */
-  virtual bool isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const = 0;
-
-  //! Replaces the Trend var with datatree.One
-  virtual expr_t replaceTrendVar() const = 0;
-
-  //! Constructs a new expression where the variable indicated by symb_id has been detrended
-  /*!
-    \param[in] symb_id indicating the variable to be detrended
-    \param[in] log_trend indicates if the trend is in log
-    \param[in] trend indicating the trend
-    \return the new binary op pointing to a detrended variable
-  */
-  virtual expr_t detrend(int symb_id, bool log_trend, expr_t trend) const = 0;
-
-  //! Add ExprNodes to the provided datatree
-  virtual expr_t cloneDynamic(DataTree &dynamic_datatree) const = 0;
-
-  //! Move a trend variable with lag/lead to time t by dividing/multiplying by its growth factor
-  virtual expr_t removeTrendLeadLag(map<int, expr_t> trend_symbols_map) const = 0;
-
-  //! Returns true if the expression is in static form (no lead, no lag, no expectation, no STEADY_STATE)
-  virtual bool isInStaticForm() const = 0;
-
-  //! Substitute auxiliary variables by their expression in static model
-  virtual expr_t substituteStaticAuxiliaryVariable() const = 0;
-
-  //! Add index information for var_model variables
-  virtual void setVarExpectationIndex(map<string, pair<SymbolList, int> > &var_model_info) = 0;
-
-  //! Returns true if model_info_name is referenced by a VarExpectationNode
-  virtual bool isVarModelReferenced(const string &model_info_name) const = 0;
-
-  //! Fills map
-  virtual void getEndosAndMaxLags(map<string, int> &model_endos_and_lags) const = 0;
-};
+    class ExprNode
+    {
+      friend class DataTree;
+      friend class DynamicModel;
+      friend class StaticModel;
+      friend class ModelTree;
+      friend struct ExprNodeLess;
+      friend class NumConstNode;
+      friend class VariableNode;
+      friend class UnaryOpNode;
+      friend class BinaryOpNode;
+      friend class TrinaryOpNode;
+      friend class AbstractExternalFunctionNode;
+      friend class VarExpectationNode;
+    private:
+      //! Computes derivative w.r. to a derivation ID (but doesn't store it in derivatives map)
+      /*! You shoud use getDerivative() to get the benefit of symbolic a priori and of caching */
+      virtual expr_t computeDerivative(int deriv_id) = 0;
+
+    protected:
+      //! Reference to the enclosing DataTree
+      DataTree &datatree;
+
+      //! Index number
+      int idx;
+
+      //! Is the data member non_null_derivatives initialized ?
+      bool preparedForDerivation;
+
+      //! Set of derivation IDs with respect to which the derivative is potentially non-null
+      set<int> non_null_derivatives;
+
+      //! Used for caching of first order derivatives (when non-null)
+      map<int, expr_t> derivatives;
+
+      //! Cost of computing current node
+      /*! Nodes included in temporary_terms are considered having a null cost */
+      virtual int cost(int cost, bool is_matlab) const;
+      virtual int cost(const temporary_terms_t &temporary_terms, bool is_matlab) const;
+      virtual int cost(const map<NodeTreeReference, temporary_terms_t> &temp_terms_map, bool is_matlab) const;
+
+      //! For creating equation cross references
+      struct EquationInfo
+      {
+        set<pair<int, int> > param;
+        set<pair<int, int> > endo;
+        set<pair<int, int> > exo;
+        set<pair<int, int> > exo_det;
+      };
+
+    public:
+      ExprNode(DataTree &datatree_arg);
+      virtual
+      ~ExprNode();
+
+      //! Initializes data member non_null_derivatives
+      virtual void prepareForDerivation() = 0;
+
+      //! Returns derivative w.r. to derivation ID
+      /*! Uses a symbolic a priori to pre-detect null derivatives, and caches the result for other derivatives (to avoid computing it several times)
+        For an equal node, returns the derivative of lhs minus rhs */
+      expr_t getDerivative(int deriv_id);
+
+      //! Computes derivatives by applying the chain rule for some variables
+      /*!
+        \param deriv_id The derivation ID with respect to which we are derivating
+        \param recursive_variables Contains the derivation ID for which chain rules must be applied. Keys are derivation IDs, values are equations of the form x=f(y) where x is the key variable and x doesn't appear in y
+      */
+      virtual expr_t getChainRuleDerivative(int deriv_id, const map<int, expr_t> &recursive_variables) = 0;
+
+      //! Returns precedence of node
+      /*! Equals 100 for constants, variables, unary ops, and temporary terms */
+      virtual int precedence(ExprNodeOutputType output_t, const temporary_terms_t &temporary_terms) const;
+
+      //! Fills temporary_terms set, using reference counts
+      /*! A node will be marked as a temporary term if it is referenced at least two times (i.e. has at least two parents), and has a computing cost (multiplied by reference count) greater to datatree.min_cost */
+      virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
+                                         map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
+                                         bool is_matlab, NodeTreeReference tr) const;
+
+      //! Writes output of node, using a Txxx notation for nodes in temporary_terms, and specifiying the set of already written external functions
+      /*!
+        \param[in] output the output stream
+        \param[in] output_type the type of output (MATLAB, C, LaTeX...)
+        \param[in] temporary_terms the nodes that are marked as temporary terms
+        \param[in,out] tef_terms the set of already written external function nodes
+      */
+      virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms) const = 0;
+
+      //! returns true if the expr node contains an external function
+      virtual bool containsExternalFunction() const = 0;
+
+      //! Writes output of node (with no temporary terms and with "outside model" output type)
+      void writeOutput(ostream &output) const;
+
+      //! Writes output of node (with no temporary terms)
+      void writeOutput(ostream &output, ExprNodeOutputType output_type) const;
+
+      //! Writes output of node, using a Txxx notation for nodes in temporary_terms
+      void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms) const;
+
+      //! Writes the output for an external function, ensuring that the external function is called as few times as possible using temporary terms
+      virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
+                                               const temporary_terms_t &temporary_terms,
+                                               deriv_node_temp_terms_t &tef_terms) const;
+
+      virtual void compileExternalFunctionOutput(ostream &CompileCode, unsigned int &instruction_number,
+                                                 bool lhs_rhs, const temporary_terms_t &temporary_terms,
+                                                 const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
+                                                 deriv_node_temp_terms_t &tef_terms) const;
+
+      //! Computes the set of all variables of a given symbol type in the expression (with information on lags)
+      /*!
+        Variables are stored as integer pairs of the form (symb_id, lag).
+        They are added to the set given in argument.
+        Note that model local variables are substituted by their expression in the computation
+        (and added if type_arg = ModelLocalVariable).
+      */
+      virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const = 0;
+
+      //! Computes the set of all variables of a given symbol type in the expression (without information on lags)
+      /*!
+        Variables are stored as symb_id.
+        They are added to the set given in argument.
+        Note that model local variables are substituted by their expression in the computation
+        (and added if type_arg = ModelLocalVariable).
+      */
+      void collectVariables(SymbolType type_arg, set<int> &result) const;
+
+      //! Computes the set of endogenous variables in the expression
+      /*!
+        Endogenous are stored as integer pairs of the form (type_specific_id, lag).
+        They are added to the set given in argument.
+        Note that model local variables are substituted by their expression in the computation.
+      */
+      virtual void collectEndogenous(set<pair<int, int> > &result) const;
+
+      //! Computes the set of exogenous variables in the expression
+      /*!
+        Exogenous are stored as integer pairs of the form (type_specific_id, lag).
+        They are added to the set given in argument.
+        Note that model local variables are substituted by their expression in the computation.
+      */
+      virtual void collectExogenous(set<pair<int, int> > &result) const;
+
+      virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const = 0;
+
+      virtual void computeTemporaryTerms(map<expr_t, int> &reference_count,
+                                         temporary_terms_t &temporary_terms,
+                                         map<expr_t, pair<int, int> > &first_occurence,
+                                         int Curr_block,
+                                         vector< vector<temporary_terms_t> > &v_temporary_terms,
+                                         int equation) const;
+
+      class EvalException
+
+      {
+      };
+
+      class EvalExternalFunctionException : public EvalException
+
+      {
+      };
+
+      virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) = 0;
+      virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const = 0;
+      void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic) const;
+      //! Creates a static version of this node
+      /*!
+        This method duplicates the current node by creating a similar node from which all leads/lags have been stripped,
+        adds the result in the static_datatree argument (and not in the original datatree), and returns it.
+      */
+      virtual expr_t toStatic(DataTree &static_datatree) const = 0;
+
+      /*!
+        Compute cross references for equations
+      */
+      //  virtual void computeXrefs(set<int> &param, set<int> &endo, set<int> &exo, set<int> &exo_det) const = 0;
+      virtual void computeXrefs(EquationInfo &ei) const = 0;
+      //! Try to normalize an equation linear in its endogenous variable
+      virtual pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t> > > &List_of_Op_RHS) const = 0;
+
+      //! Returns the maximum lead of endogenous in this expression
+      /*! Always returns a non-negative value */
+      virtual int maxEndoLead() const = 0;
+
+      //! Returns the maximum lead of exogenous in this expression
+      /*! Always returns a non-negative value */
+      virtual int maxExoLead() const = 0;
+
+      //! Returns the maximum lag of endogenous in this expression
+      /*! Always returns a non-negative value */
+      virtual int maxEndoLag() const = 0;
+
+      //! Returns the maximum lag of exogenous in this expression
+      /*! Always returns a non-negative value */
+      virtual int maxExoLag() const = 0;
+
+      //! Returns the relative period of the most forward term in this expression
+      /*! A negative value means that the expression contains only lagged variables */
+      virtual int maxLead() const = 0;
+
+      //! Returns a new expression where all the leads/lags have been shifted backwards by the same amount
+      /*!
+        Only acts on endogenous, exogenous, exogenous det
+        \param[in] n The number of lags by which to shift
+        \return The same expression except that leads/lags have been shifted backwards
+      */
+      virtual expr_t decreaseLeadsLags(int n) const = 0;
+
+      //! Type for the substitution map used in the process of creating auxiliary vars for leads >= 2
+      typedef map<const ExprNode *, const VariableNode *> subst_table_t;
+
+      //! Creates auxiliary endo lead variables corresponding to this expression
+      /*!
+        If maximum endogenous lead >= 3, this method will also create intermediary auxiliary var, and will add the equations of the form aux1 = aux2(+1) to the substitution table.
+        \pre This expression is assumed to have maximum endogenous lead >= 2
+        \param[in,out] subst_table The table to which new auxiliary variables and their correspondance will be added
+        \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
+        \return The new variable node corresponding to the current expression
+      */
+      VariableNode *createEndoLeadAuxiliaryVarForMyself(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
+
+      //! Creates auxiliary exo lead variables corresponding to this expression
+      /*!
+        If maximum exogenous lead >= 2, this method will also create intermediary auxiliary var, and will add the equations of the form aux1 = aux2(+1) to the substitution table.
+        \pre This expression is assumed to have maximum exogenous lead >= 1
+        \param[in,out] subst_table The table to which new auxiliary variables and their correspondance will be added
+        \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
+        \return The new variable node corresponding to the current expression
+      */
+      VariableNode *createExoLeadAuxiliaryVarForMyself(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const;
+
+      //! Constructs a new expression where sub-expressions with max endo lead >= 2 have been replaced by auxiliary variables
+      /*!
+        \param[in,out] subst_table Map used to store expressions that have already be substituted and their corresponding variable, in order to avoid creating two auxiliary variables for the same sub-expr.
+        \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
+
+        If the method detects a sub-expr which needs to be substituted, two cases are possible:
+        - if this expr is in the table, then it will use the corresponding variable and return the substituted expression
+        - if this expr is not in the table, then it will create an auxiliary endogenous variable, add the substitution in the table and return the substituted expression
+
+        \return A new equivalent expression where sub-expressions with max endo lead >= 2 have been replaced by auxiliary variables
+      */
+      virtual expr_t substituteEndoLeadGreaterThanTwo(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool deterministic_model) const = 0;
+
+      //! Constructs a new expression where endo variables with max endo lag >= 2 have been replaced by auxiliary variables
+      /*!
+        \param[in,out] subst_table Map used to store expressions that have already be substituted and their corresponding variable, in order to avoid creating two auxiliary variables for the same sub-expr.
+        \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
+      */
+      virtual expr_t substituteEndoLagGreaterThanTwo(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const = 0;
+
+      //! Constructs a new expression where exogenous variables with a lead have been replaced by auxiliary variables
+      /*!
+        \param[in,out] subst_table Map used to store expressions that have already be substituted and their corresponding variable, in order to avoid creating two auxiliary variables for the same sub-expr.
+        \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
+      */
+      virtual expr_t substituteExoLead(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool deterministic_model) const = 0;
+      //! Constructs a new expression where exogenous variables with a lag have been replaced by auxiliary variables
+      /*!
+        \param[in,out] subst_table Map used to store expressions that have already be substituted and their corresponding variable, in order to avoid creating two auxiliary variables for the same sub-expr.
+        \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
+      */
+      virtual expr_t substituteExoLag(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const = 0;
+
+      //! Constructs a new expression where the expectation operator has been replaced by auxiliary variables
+      /*!
+        \param[in,out] subst_table Map used to store expressions that have already be substituted and their corresponding variable, in order to avoid creating two auxiliary variables for the same sub-expr.
+        \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
+        \param[in] partial_information_model Are we substituting in a partial information model?
+      */
+      virtual expr_t substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs, bool partial_information_model) const = 0;
+
+      virtual expr_t decreaseLeadsLagsPredeterminedVariables() const = 0;
+
+      //! Constructs a new expression where forward variables (supposed to be at most in t+1) have been replaced by themselves at t, plus a new aux var representing their (time) differentiate
+      /*!
+        \param[in] subset variables to which to limit the transformation; transform
+        all fwrd vars if empty
+        \param[in,out] subst_table Map used to store mapping between a given
+        forward variable and the aux var that contains its differentiate
+        \param[out] neweqs Equations to be added to the model to match the creation of auxiliary variables.
+      */
+      virtual expr_t differentiateForwardVars(const vector<string> &subset, subst_table_t &subst_table, vector<BinaryOpNode *> &neweqs) const = 0;
+
+      //! Return true if the nodeID is a numerical constant equal to value and false otherwise
+      /*!
+        \param[in] value of the numerical constante
+        \param[out] the boolean equal to true if NodeId is a constant equal to value
+      */
+      virtual bool isNumConstNodeEqualTo(double value) const = 0;
+
+      //! Returns true if the expression contains one or several endogenous variable
+      virtual bool containsEndogenous(void) const = 0;
+
+      //! Returns true if the expression contains one or several exogenous variable
+      virtual bool containsExogenous() const = 0;
+
+      //! Return true if the nodeID is a variable withe a type equal to type_arg, a specific variable id aqual to varfiable_id and a lag equal to lag_arg and false otherwise
+      /*!
+        \param[in] the type (type_arg), specifique variable id (variable_id and the lag (lag_arg)
+        \param[out] the boolean equal to true if NodeId is the variable
+      */
+      virtual bool isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const = 0;
+
+      //! Replaces the Trend var with datatree.One
+      virtual expr_t replaceTrendVar() const = 0;
+
+      //! Constructs a new expression where the variable indicated by symb_id has been detrended
+      /*!
+        \param[in] symb_id indicating the variable to be detrended
+        \param[in] log_trend indicates if the trend is in log
+        \param[in] trend indicating the trend
+        \return the new binary op pointing to a detrended variable
+      */
+      virtual expr_t detrend(int symb_id, bool log_trend, expr_t trend) const = 0;
+
+      //! Add ExprNodes to the provided datatree
+      virtual expr_t cloneDynamic(DataTree &dynamic_datatree) const = 0;
+
+      //! Move a trend variable with lag/lead to time t by dividing/multiplying by its growth factor
+      virtual expr_t removeTrendLeadLag(map<int, expr_t> trend_symbols_map) const = 0;
+
+      //! Returns true if the expression is in static form (no lead, no lag, no expectation, no STEADY_STATE)
+      virtual bool isInStaticForm() const = 0;
+
+      //! Substitute auxiliary variables by their expression in static model
+      virtual expr_t substituteStaticAuxiliaryVariable() const = 0;
+
+      //! Add index information for var_model variables
+      virtual void setVarExpectationIndex(map<string, pair<SymbolList, int> > &var_model_info) = 0;
+
+      //! Returns true if model_info_name is referenced by a VarExpectationNode
+      virtual bool isVarModelReferenced(const string &model_info_name) const = 0;
+
+      //! Fills map
+      virtual void getEndosAndMaxLags(map<string, int> &model_endos_and_lags) const = 0;
+    };
 
 //! Object used to compare two nodes (using their indexes)
 struct ExprNodeLess
@@ -564,7 +565,11 @@ public:
   {
     return symb_id;
   };
-  int get_lag() const { return lag; };
+  int
+  get_lag() const
+  {
+    return lag;
+  };
   virtual pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t> > >  &List_of_Op_RHS) const;
   virtual expr_t getChainRuleDerivative(int deriv_id, const map<int, expr_t> &recursive_variables);
   virtual int maxEndoLead() const;
diff --git a/ExtendedPreprocessorTypes.hh b/ExtendedPreprocessorTypes.hh
index e0a955f2c8222b611512d31a296902b9e4e65fbd..4c6869a38a9f9940e9e808ea925704ac9467e799 100644
--- a/ExtendedPreprocessorTypes.hh
+++ b/ExtendedPreprocessorTypes.hh
@@ -24,9 +24,9 @@ enum FileOutputType
   {
     none,                             // outputs files for Matlab/Octave processing
     dynamic,                          // outputs <fname>_dynamic.* and related files
-    first,                            // outputs <fname>_first_derivatives.* and related files 
-    second,                           // outputs <fname>_first_derivatives.*, <fname>_second_derivatives.* and related files 
-    third,                            // outputs <fname>_first_derivatives.*, <fname>_second_derivatives.*, <fname>_third_derivatives.*  and related files 
+    first,                            // outputs <fname>_first_derivatives.* and related files
+    second,                           // outputs <fname>_first_derivatives.*, <fname>_second_derivatives.* and related files
+    third,                            // outputs <fname>_first_derivatives.*, <fname>_second_derivatives.*, <fname>_third_derivatives.*  and related files
   };
 
 enum LanguageOutputType
diff --git a/MinimumFeedbackSet.cc b/MinimumFeedbackSet.cc
index 479c8f227cee2544e952048c3c8a89ccd2a71e35..a84a994aba5dcef4da1674b99039310617ddbb90 100644
--- a/MinimumFeedbackSet.cc
+++ b/MinimumFeedbackSet.cc
@@ -175,7 +175,7 @@ namespace MFS
     if (in_degree(vertex, G) > 0 && out_degree(vertex, G) > 0)
       for (tie(it_in, in_end) = in_edges(vertex, G); it_in != in_end; ++it_in)
         for (tie(it_out, out_end) = out_edges(vertex, G); it_out != out_end; ++it_out)
-          if (source(*it_in, G) == target(*it_out, G) && source(*it_in, G) != target(*it_in, G))                                                                                                                                                                                                                                                                                                       // not a loop
+          if (source(*it_in, G) == target(*it_out, G) && source(*it_in, G) != target(*it_in, G))                                                                                                                                                                                                                                                                                                                                                                                                         // not a loop
             Doublet.push_back(source(*it_in, G));
     return Doublet;
   }
diff --git a/ModFile.cc b/ModFile.cc
index 6f99f904d55c7f9f6ae13452811089ba93622478..2aa4a39281bc5b9bc5b872f30b2d7c351ea8b317 100644
--- a/ModFile.cc
+++ b/ModFile.cc
@@ -39,7 +39,7 @@ ModFile::ModFile(WarningConsolidation &warnings_arg)
     orig_ramsey_dynamic_model(symbol_table, num_constants, external_functions_table),
     static_model(symbol_table, num_constants, external_functions_table),
     steady_state_model(symbol_table, num_constants, external_functions_table, static_model),
-    linear(false), block(false), byte_code(false), use_dll(false), no_static(false), 
+    linear(false), block(false), byte_code(false), use_dll(false), no_static(false),
     differentiate_forward_vars(false), nonstationary_variables(false),
     param_used_with_lead_lag(false), warnings(warnings_arg)
 {
@@ -148,10 +148,10 @@ ModFile::checkPass(bool nostrict)
       exit(EXIT_FAILURE);
     }
 
-  if (((mod_file_struct.ramsey_model_present || mod_file_struct.discretionary_policy_present) 
+  if (((mod_file_struct.ramsey_model_present || mod_file_struct.discretionary_policy_present)
        && !mod_file_struct.planner_objective_present)
       || (!(mod_file_struct.ramsey_model_present || mod_file_struct.discretionary_policy_present)
-	  && mod_file_struct.planner_objective_present))
+          && mod_file_struct.planner_objective_present))
     {
       cerr << "ERROR: A planner_objective statement must be used with a ramsey_model, a ramsey_policy or a discretionary_policy statement and vice versa." << endl;
       exit(EXIT_FAILURE);
@@ -256,38 +256,38 @@ ModFile::checkPass(bool nostrict)
       cerr << "ERROR: the number of equations marked [static] must be equal to the number of equations marked [dynamic]" << endl;
       exit(EXIT_FAILURE);
     }
-  
-  if (dynamic_model.staticOnlyEquationsNbr() > 0 &&
-      (mod_file_struct.ramsey_model_present || mod_file_struct.discretionary_policy_present))
+
+  if (dynamic_model.staticOnlyEquationsNbr() > 0
+      && (mod_file_struct.ramsey_model_present || mod_file_struct.discretionary_policy_present))
     {
       cerr << "ERROR: marking equations as [static] or [dynamic] is not possible with ramsey_model, ramsey_policy or discretionary_policy" << endl;
       exit(EXIT_FAILURE);
     }
 
-  if (stochastic_statement_present &&
-      (dynamic_model.isUnaryOpUsed(oSign)
-       || dynamic_model.isUnaryOpUsed(oAbs)
-       || dynamic_model.isBinaryOpUsed(oMax)
-       || dynamic_model.isBinaryOpUsed(oMin)
-       || dynamic_model.isBinaryOpUsed(oGreater)
-       || dynamic_model.isBinaryOpUsed(oLess)
-       || dynamic_model.isBinaryOpUsed(oGreaterEqual)
-       || dynamic_model.isBinaryOpUsed(oLessEqual)
-       || dynamic_model.isBinaryOpUsed(oEqualEqual)
-       || dynamic_model.isBinaryOpUsed(oDifferent)))
+  if (stochastic_statement_present
+      && (dynamic_model.isUnaryOpUsed(oSign)
+          || dynamic_model.isUnaryOpUsed(oAbs)
+          || dynamic_model.isBinaryOpUsed(oMax)
+          || dynamic_model.isBinaryOpUsed(oMin)
+          || dynamic_model.isBinaryOpUsed(oGreater)
+          || dynamic_model.isBinaryOpUsed(oLess)
+          || dynamic_model.isBinaryOpUsed(oGreaterEqual)
+          || dynamic_model.isBinaryOpUsed(oLessEqual)
+          || dynamic_model.isBinaryOpUsed(oEqualEqual)
+          || dynamic_model.isBinaryOpUsed(oDifferent)))
     warnings << "WARNING: you are using a function (max, min, abs, sign) or an operator (<, >, <=, >=, ==, !=) which is unsuitable for a stochastic context; see the reference manual, section about \"Expressions\", for more details." << endl;
 
-  if (linear &&
-      (dynamic_model.isUnaryOpUsed(oSign)
-       || dynamic_model.isUnaryOpUsed(oAbs)
-       || dynamic_model.isBinaryOpUsed(oMax)
-       || dynamic_model.isBinaryOpUsed(oMin)
-       || dynamic_model.isBinaryOpUsed(oGreater)
-       || dynamic_model.isBinaryOpUsed(oLess)
-       || dynamic_model.isBinaryOpUsed(oGreaterEqual)
-       || dynamic_model.isBinaryOpUsed(oLessEqual)
-       || dynamic_model.isBinaryOpUsed(oEqualEqual)
-       || dynamic_model.isBinaryOpUsed(oDifferent)))
+  if (linear
+      && (dynamic_model.isUnaryOpUsed(oSign)
+          || dynamic_model.isUnaryOpUsed(oAbs)
+          || dynamic_model.isBinaryOpUsed(oMax)
+          || dynamic_model.isBinaryOpUsed(oMin)
+          || dynamic_model.isBinaryOpUsed(oGreater)
+          || dynamic_model.isBinaryOpUsed(oLess)
+          || dynamic_model.isBinaryOpUsed(oGreaterEqual)
+          || dynamic_model.isBinaryOpUsed(oLessEqual)
+          || dynamic_model.isBinaryOpUsed(oEqualEqual)
+          || dynamic_model.isBinaryOpUsed(oDifferent)))
     warnings << "WARNING: you have declared your model 'linear' but you are using a function (max, min, abs, sign) or an operator (<, >, <=, >=, ==, !=) which potentially makes it non-linear." << endl;
 
   // Test if some estimated parameters are used within the values of shocks
@@ -302,7 +302,7 @@ ModFile::checkPass(bool nostrict)
     {
       cerr << "ERROR: some estimated parameters (";
       for (set<int>::const_iterator it = parameters_intersect.begin();
-           it != parameters_intersect.end(); )
+           it != parameters_intersect.end();)
         {
           cerr << symbol_table.getName(*it);
           if (++it != parameters_intersect.end())
@@ -393,7 +393,7 @@ ModFile::transformPass(bool nostrict, bool compute_xrefs)
       /*
         clone the model then clone the new equations back to the original because
         we have to call computeDerivIDs (in computeRamseyPolicyFOCs and computingPass)
-       */
+      */
       if (linear)
         dynamic_model.cloneDynamic(orig_ramsey_dynamic_model);
       dynamic_model.cloneDynamic(ramsey_FOC_equations_dynamic_model);
@@ -527,64 +527,64 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output, int params_deri
       // Compute static model and its derivatives
       dynamic_model.toStatic(static_model);
       if (!no_static)
-	{
-	  if (mod_file_struct.stoch_simul_present
-	      || mod_file_struct.estimation_present || mod_file_struct.osr_present
-	      || mod_file_struct.ramsey_model_present || mod_file_struct.identification_present
-	      || mod_file_struct.calib_smoother_present)
-	    static_model.set_cutoff_to_zero();
-
-	  const bool static_hessian = mod_file_struct.identification_present
-	    || mod_file_struct.estimation_analytic_derivation;
+        {
+          if (mod_file_struct.stoch_simul_present
+              || mod_file_struct.estimation_present || mod_file_struct.osr_present
+              || mod_file_struct.ramsey_model_present || mod_file_struct.identification_present
+              || mod_file_struct.calib_smoother_present)
+            static_model.set_cutoff_to_zero();
+
+          const bool static_hessian = mod_file_struct.identification_present
+            || mod_file_struct.estimation_analytic_derivation;
           int paramsDerivsOrder = 0;
           if (mod_file_struct.identification_present || mod_file_struct.estimation_analytic_derivation)
             paramsDerivsOrder = params_derivs_order;
-	  static_model.computingPass(global_eval_context, no_tmp_terms, static_hessian,
-				     false, paramsDerivsOrder, block, byte_code);
-	}
+          static_model.computingPass(global_eval_context, no_tmp_terms, static_hessian,
+                                     false, paramsDerivsOrder, block, byte_code);
+        }
       // Set things to compute for dynamic model
       if (mod_file_struct.perfect_foresight_solver_present || mod_file_struct.check_present
-	  || mod_file_struct.stoch_simul_present
-	  || mod_file_struct.estimation_present || mod_file_struct.osr_present
-	  || mod_file_struct.ramsey_model_present || mod_file_struct.identification_present
-	  || mod_file_struct.calib_smoother_present)
-	{
-	  if (mod_file_struct.perfect_foresight_solver_present)
-	    dynamic_model.computingPass(true, false, false, none, global_eval_context, no_tmp_terms, block, use_dll, byte_code);
-	      else
-		{
-		  if (mod_file_struct.stoch_simul_present
-		      || mod_file_struct.estimation_present || mod_file_struct.osr_present
-		      || mod_file_struct.ramsey_model_present || mod_file_struct.identification_present
-		      || mod_file_struct.calib_smoother_present)
-		    dynamic_model.set_cutoff_to_zero();
-		  if (mod_file_struct.order_option < 1 || mod_file_struct.order_option > 3)
-		    {
-		      cerr << "ERROR: Incorrect order option..." << endl;
-		      exit(EXIT_FAILURE);
-		    }
-		  bool hessian = mod_file_struct.order_option >= 2 
-		    || mod_file_struct.identification_present 
-		    || mod_file_struct.estimation_analytic_derivation
-                    || linear
-		    || output == second 
-		    || output == third;
-		  bool thirdDerivatives = mod_file_struct.order_option == 3 
-		    || mod_file_struct.estimation_analytic_derivation
-		    || output == third;
-                  int paramsDerivsOrder = 0;
-                  if (mod_file_struct.identification_present || mod_file_struct.estimation_analytic_derivation)
-                    paramsDerivsOrder = params_derivs_order;
-		  dynamic_model.computingPass(true, hessian, thirdDerivatives, paramsDerivsOrder, global_eval_context, no_tmp_terms, block, use_dll, byte_code);
-                  if (linear && mod_file_struct.ramsey_model_present)
-                    orig_ramsey_dynamic_model.computingPass(true, true, false, paramsDerivsOrder, global_eval_context, no_tmp_terms, block, use_dll, byte_code);
-		}
-	    }
-	  else // No computing task requested, compute derivatives up to 2nd order by default
-	    dynamic_model.computingPass(true, true, false, none, global_eval_context, no_tmp_terms, block, use_dll, byte_code);
-
-      if ((linear && !mod_file_struct.ramsey_model_present && !dynamic_model.checkHessianZero()) ||
-          (linear && mod_file_struct.ramsey_model_present && !orig_ramsey_dynamic_model.checkHessianZero()))
+          || mod_file_struct.stoch_simul_present
+          || mod_file_struct.estimation_present || mod_file_struct.osr_present
+          || mod_file_struct.ramsey_model_present || mod_file_struct.identification_present
+          || mod_file_struct.calib_smoother_present)
+        {
+          if (mod_file_struct.perfect_foresight_solver_present)
+            dynamic_model.computingPass(true, false, false, none, global_eval_context, no_tmp_terms, block, use_dll, byte_code);
+          else
+            {
+              if (mod_file_struct.stoch_simul_present
+                  || mod_file_struct.estimation_present || mod_file_struct.osr_present
+                  || mod_file_struct.ramsey_model_present || mod_file_struct.identification_present
+                  || mod_file_struct.calib_smoother_present)
+                dynamic_model.set_cutoff_to_zero();
+              if (mod_file_struct.order_option < 1 || mod_file_struct.order_option > 3)
+                {
+                  cerr << "ERROR: Incorrect order option..." << endl;
+                  exit(EXIT_FAILURE);
+                }
+              bool hessian = mod_file_struct.order_option >= 2
+                || mod_file_struct.identification_present
+                || mod_file_struct.estimation_analytic_derivation
+                || linear
+                || output == second
+                || output == third;
+              bool thirdDerivatives = mod_file_struct.order_option == 3
+                || mod_file_struct.estimation_analytic_derivation
+                || output == third;
+              int paramsDerivsOrder = 0;
+              if (mod_file_struct.identification_present || mod_file_struct.estimation_analytic_derivation)
+                paramsDerivsOrder = params_derivs_order;
+              dynamic_model.computingPass(true, hessian, thirdDerivatives, paramsDerivsOrder, global_eval_context, no_tmp_terms, block, use_dll, byte_code);
+              if (linear && mod_file_struct.ramsey_model_present)
+                orig_ramsey_dynamic_model.computingPass(true, true, false, paramsDerivsOrder, global_eval_context, no_tmp_terms, block, use_dll, byte_code);
+            }
+        }
+      else // No computing task requested, compute derivatives up to 2nd order by default
+        dynamic_model.computingPass(true, true, false, none, global_eval_context, no_tmp_terms, block, use_dll, byte_code);
+
+      if ((linear && !mod_file_struct.ramsey_model_present && !dynamic_model.checkHessianZero())
+          || (linear && mod_file_struct.ramsey_model_present && !orig_ramsey_dynamic_model.checkHessianZero()))
         {
           map<int, string> eqs;
           if (mod_file_struct.ramsey_model_present)
@@ -650,15 +650,15 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
   if (clear_all)
     mOutputFile << "if isoctave || matlab_ver_less_than('8.6')" << endl
                 << "    clear all" << endl
-		<< "else" << endl
-		<< "    clearvars -global" << endl
-		<< "    clear_persistent_variables(fileparts(which('dynare')), false)" << endl
-		<< "end" << endl;
+                << "else" << endl
+                << "    clearvars -global" << endl
+                << "    clear_persistent_variables(fileparts(which('dynare')), false)" << endl
+                << "end" << endl;
   else if (clear_global)
     mOutputFile << "clear M_ options_ oo_ estim_params_ bayestopt_ dataset_ dataset_info estimation_info ys0_ ex0_;" << endl;
 
   mOutputFile << "tic0 = tic;" << endl
-	      << "% Define global variables." << endl
+              << "% Define global variables." << endl
               << "global M_ options_ oo_ estim_params_ bayestopt_ dataset_ dataset_info estimation_info ys0_ ex0_" << endl
               << "options_ = [];" << endl
               << "M_.fname = '" << basename << "';" << endl
@@ -748,7 +748,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
   bool hasModelChanged = !dynamic_model.isChecksumMatching(basename);
   if (!check_model_changes)
     hasModelChanged = true;
-  
+
   if (hasModelChanged)
     {
       // Erase possible remnants of previous runs
@@ -763,7 +763,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
       unlink((basename + "_steadystate2.m").c_str());
       unlink((basename + "_set_auxiliary_variables.m").c_str());
     }
-  
+
   if (!use_dll)
     {
       mOutputFile << "erase_compiled_function('" + basename + "_static');" << endl;
@@ -771,7 +771,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
     }
 
 #if defined(_WIN32) || defined(__CYGWIN32__)
-#if (defined(_MSC_VER) && _MSC_VER < 1700)
+# if (defined(_MSC_VER) && _MSC_VER < 1700)
   // If using USE_DLL with MSVC 10.0 or earlier, check that the user didn't use a function not supported by the compiler (because MSVC <= 10.0 doesn't comply with C99 standard)
   if (use_dll && msvc)
     {
@@ -791,7 +791,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
           exit(EXIT_FAILURE);
         }
     }
-#endif
+# endif
 #endif
 
   // Compile the dynamic MEX file for use_dll option
@@ -801,10 +801,10 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
 #if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__)
       if (msvc)
         // MATLAB/Windows + Microsoft Visual C++
-	mOutputFile << "dyn_mex('msvc', '" << basename << "', " << !check_model_changes << ")" <<  endl;
+        mOutputFile << "dyn_mex('msvc', '" << basename << "', " << !check_model_changes << ")" <<  endl;
       else if (cygwin)
         // MATLAB/Windows + Cygwin g++
-	mOutputFile << "dyn_mex('cygwin', '" << basename << "', " << !check_model_changes << ")" << endl;
+        mOutputFile << "dyn_mex('cygwin', '" << basename << "', " << !check_model_changes << ")" << endl;
       else if (mingw)
         // MATLAB/Windows + MinGW g++
         mOutputFile << "dyn_mex('mingw', '" << basename << "', " << !check_model_changes << ")" << endl;
@@ -894,7 +894,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
   config_file.writeEndParallel(mOutputFile);
 
   mOutputFile << endl << endl
-	      << "disp(['Total computing time : ' dynsec2hms(toc(tic0)) ]);" << endl;
+              << "disp(['Total computing time : ' dynsec2hms(toc(tic0)) ]);" << endl;
 
   if (!no_warn)
     {
@@ -905,7 +905,6 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
                   << "  disp('Note: warning(s) encountered in MATLAB/Octave code')" << endl
                   << "end" << endl;
     }
-  
 
   if (!no_log)
     mOutputFile << "diary off" << endl;
@@ -916,16 +915,16 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
     {
       // Create static and dynamic files
       if (dynamic_model.equation_number() > 0)
-	{
-	  if (!no_static)
-	    {
-	      static_model.writeStaticFile(basename, block, byte_code, use_dll, false);
-	      static_model.writeParamsDerivativesFile(basename, false);
-	    }
+        {
+          if (!no_static)
+            {
+              static_model.writeStaticFile(basename, block, byte_code, use_dll, false);
+              static_model.writeParamsDerivativesFile(basename, false);
+            }
 
-	  dynamic_model.writeDynamicFile(basename, block, byte_code, use_dll, mod_file_struct.order_option, false);
-	  dynamic_model.writeParamsDerivativesFile(basename, false);
-	}
+          dynamic_model.writeDynamicFile(basename, block, byte_code, use_dll, mod_file_struct.order_option, false);
+          dynamic_model.writeParamsDerivativesFile(basename, false);
+        }
 
       // Create steady state file
       steady_state_model.writeSteadyStateFile(basename, mod_file_struct.ramsey_model_present, false);
@@ -937,7 +936,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
 void
 ModFile::writeExternalFiles(const string &basename, FileOutputType output, LanguageOutputType language) const
 {
-  switch(language)
+  switch (language)
     {
     case c:
       writeExternalFilesC(basename, output);
@@ -965,7 +964,6 @@ ModFile::writeExternalFilesC(const string &basename, FileOutputType output) cons
   if (!no_static)
     static_model.writeStaticFile(basename, false, false, true, false);
 
-
   //  static_model.writeStaticCFile(basename, block, byte_code, use_dll);
   //  static_model.writeParamsDerivativesFileC(basename, cuda);
   //  static_model.writeAuxVarInitvalC(mOutputFile, oMatlabOutsideModel, cuda);
@@ -978,8 +976,8 @@ ModFile::writeExternalFilesC(const string &basename, FileOutputType output) cons
     dynamic_model.writeSecondDerivativesC_csr(basename, cuda);
   else if (output == third)
     {
-        dynamic_model.writeSecondDerivativesC_csr(basename, cuda);
-  	dynamic_model.writeThirdDerivativesC_csr(basename, cuda);
+      dynamic_model.writeSecondDerivativesC_csr(basename, cuda);
+      dynamic_model.writeThirdDerivativesC_csr(basename, cuda);
     }
 }
 
@@ -1023,7 +1021,7 @@ ModFile::writeModelC(const string &basename) const
   // Print statements
   for (vector<Statement *>::const_iterator it = statements.begin();
        it != statements.end(); it++)
-      (*it)->writeCOutput(mDriverCFile, basename);
+    (*it)->writeCOutput(mDriverCFile, basename);
 
   mDriverCFile << "} DynareInfo;" << endl;
   mDriverCFile.close();
@@ -1083,8 +1081,8 @@ ModFile::writeExternalFilesCC(const string &basename, FileOutputType output) con
     dynamic_model.writeSecondDerivativesC_csr(basename, cuda);
   else if (output == third)
     {
-        dynamic_model.writeSecondDerivativesC_csr(basename, cuda);
-  	dynamic_model.writeThirdDerivativesC_csr(basename, cuda);
+      dynamic_model.writeSecondDerivativesC_csr(basename, cuda);
+      dynamic_model.writeThirdDerivativesC_csr(basename, cuda);
     }
 }
 
@@ -1128,7 +1126,7 @@ ModFile::writeModelCC(const string &basename) const
   // Print statements
   for (vector<Statement *>::const_iterator it = statements.begin();
        it != statements.end(); it++)
-      (*it)->writeCOutput(mDriverCFile, basename);
+    (*it)->writeCOutput(mDriverCFile, basename);
 
   mDriverCFile << "};" << endl;
   mDriverCFile.close();
@@ -1204,7 +1202,7 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output)
                << "if isfile(\"" << basename << "SteadyState2.jl"  "\")" << endl
                << "    using " << basename << "SteadyState2" << endl
                << "end" << endl << endl
-	       << "export model_, options_, oo_" << endl;
+               << "export model_, options_, oo_" << endl;
 
   // Write Output
   jlOutputFile << endl
@@ -1262,9 +1260,9 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output)
   steady_state_model.writeSteadyStateFile(basename, mod_file_struct.ramsey_model_present, true);
 
   // Print statements (includes parameter values)
-    for (vector<Statement *>::const_iterator it = statements.begin();
-         it != statements.end(); it++)
-        (*it)->writeJuliaOutput(jlOutputFile, basename);
+  for (vector<Statement *>::const_iterator it = statements.begin();
+       it != statements.end(); it++)
+    (*it)->writeJuliaOutput(jlOutputFile, basename);
 
   jlOutputFile << "model_.static = " << basename << "Static.static!" << endl
                << "model_.dynamic = " << basename << "Dynamic.dynamic!" << endl
@@ -1284,7 +1282,7 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output)
                << "    using " << basename << "DynamicParamsDerivs" << endl
                << "    model_.dynamic_params_derivs = " << basename << "DynamicParamsDerivs.params_derivs" << endl
                << "end" << endl
-	       << "end" << endl;
+               << "end" << endl;
   jlOutputFile.close();
   cout << "done" << endl;
 }
diff --git a/ModFile.hh b/ModFile.hh
index 68df1adfaab9c78158c9e5403b4c26a0c500994b..a4812471ee502fe2bb7f288a2d6cc688273a2c9c 100644
--- a/ModFile.hh
+++ b/ModFile.hh
@@ -41,7 +41,7 @@ using namespace std;
 
 // for checksum computation
 #ifndef PRIVATE_BUFFER_SIZE
-#define PRIVATE_BUFFER_SIZE 1024
+# define PRIVATE_BUFFER_SIZE 1024
 #endif
 
 //! The abstract representation of a "mod" file
@@ -91,9 +91,9 @@ public:
   bool differentiate_forward_vars;
 
   /*! If the 'differentiate_forward_vars' option is used, contains the set of
-      endogenous with respect to which to do the transformation;
-      if empty, means that the transformation must be applied to all endos
-      with a lead */
+    endogenous with respect to which to do the transformation;
+    if empty, means that the transformation must be applied to all endos
+    with a lead */
   vector<string> differentiate_forward_vars_subset;
 
   //! Are nonstationary variables present ?
diff --git a/ModelTree.cc b/ModelTree.cc
index ed5ecdbeb83459dae77acad7c9d9499aa02b5ef5..9bfb30eaff3b0a0ad3aa7f13853b2de4bf9dc3a1 100644
--- a/ModelTree.cc
+++ b/ModelTree.cc
@@ -212,7 +212,7 @@ ModelTree::computeNonSingularNormalization(jacob_map_t &contemporaneous_jacobian
                   if (first_derivatives.find(make_pair(it->first.first, getDerivID(symbol_table.getID(eEndogenous, it->first.second), 0))) == first_derivatives.end())
                     first_derivatives[make_pair(it->first.first, getDerivID(symbol_table.getID(eEndogenous, it->first.second), 0))] = Zero;
                 }
-              catch(DataTree::UnknownDerivIDException &e)
+              catch (DataTree::UnknownDerivIDException &e)
                 {
                   cerr << "The variable " << symbol_table.getName(symbol_table.getID(eEndogenous, it->first.second))
                        << " does not appear at the current period (i.e. with no lead and no lag); this case is not handled by the 'block' option of the 'model' block." << endl;
@@ -332,19 +332,19 @@ ModelTree::computePrologueAndEpilogue(const jacob_map_t &static_jacobian_arg, ve
       eq2endo[*it] = i;
       equation_reordered[i] = i;
       variable_reordered[*it] = i;
-    }
-  if (cutoff == 0)
-    {
+    }
+  if (cutoff == 0)
+    {
       set<pair<int, int> > endo;
       for (int i = 0; i < n; i++)
-        {
+        {
           endo.clear();
-          equations[i]->collectEndogenous(endo);
-          for (set<pair<int, int> >::const_iterator it = endo.begin(); it != endo.end(); it++)
-            IM[i * n + endo2eq[it->first]] = true;
-        }
-    }
-  else
+          equations[i]->collectEndogenous(endo);
+          for (set<pair<int, int> >::const_iterator it = endo.begin(); it != endo.end(); it++)
+            IM[i * n + endo2eq[it->first]] = true;
+        }
+    }
+  else
     for (jacob_map_t::const_iterator it = static_jacobian_arg.begin(); it != static_jacobian_arg.end(); it++)
       IM[it->first.first * n + endo2eq[it->first.second]] = true;
   bool something_has_been_done = true;
@@ -546,22 +546,22 @@ ModelTree::computeBlockDecompositionAndFeedbackVariablesForEachBlock(const jacob
     {
       reverse_equation_reordered[equation_reordered[i]] = i;
       reverse_variable_reordered[variable_reordered[i]] = i;
-    }
-  jacob_map_t tmp_normalized_contemporaneous_jacobian;
-  if (cutoff == 0)
-    {
+    }
+  jacob_map_t tmp_normalized_contemporaneous_jacobian;
+  if (cutoff == 0)
+    {
       set<pair<int, int> > endo;
       for (int i = 0; i < nb_var; i++)
-        {
+        {
           endo.clear();
-          equations[i]->collectEndogenous(endo);
-          for (set<pair<int, int> >::const_iterator it = endo.begin(); it != endo.end(); it++)
-            tmp_normalized_contemporaneous_jacobian[make_pair(i, it->first)] = 1;
-
-        }
-    }
-  else
-    tmp_normalized_contemporaneous_jacobian = static_jacobian;
+          equations[i]->collectEndogenous(endo);
+          for (set<pair<int, int> >::const_iterator it = endo.begin(); it != endo.end(); it++)
+            tmp_normalized_contemporaneous_jacobian[make_pair(i, it->first)] = 1;
+
+        }
+    }
+  else
+    tmp_normalized_contemporaneous_jacobian = static_jacobian;
   for (jacob_map_t::const_iterator it = tmp_normalized_contemporaneous_jacobian.begin(); it != tmp_normalized_contemporaneous_jacobian.end(); it++)
     if (reverse_equation_reordered[it->first.first] >= (int) prologue && reverse_equation_reordered[it->first.first] < (int) (nb_var - epilogue)
         && reverse_variable_reordered[it->first.second] >= (int) prologue && reverse_variable_reordered[it->first.second] < (int) (nb_var - epilogue)
@@ -887,7 +887,7 @@ ModelTree::reduceBlocksAndTypeDetermination(const dynamic_jacob_map_t &dynamic_j
               int c_Size = (block_type_size_mfs[block_type_size_mfs.size()-1]).second.first;
               int first_equation = (block_type_size_mfs[block_type_size_mfs.size()-1]).first.second;
               if (c_Size > 0 && ((prev_Type ==  EVALUATE_FORWARD && Simulation_Type == EVALUATE_FORWARD && !is_lead)
-                  || (prev_Type ==  EVALUATE_BACKWARD && Simulation_Type == EVALUATE_BACKWARD && !is_lag)))
+                                 || (prev_Type ==  EVALUATE_BACKWARD && Simulation_Type == EVALUATE_BACKWARD && !is_lag)))
                 {
                   for (int j = first_equation; j < first_equation+c_Size; j++)
                     {
@@ -1125,10 +1125,10 @@ ModelTree::computeTemporaryTerms(bool is_matlab)
   temporary_terms_g2.clear();
   temporary_terms_g3.clear();
   map<NodeTreeReference, temporary_terms_t> temp_terms_map;
-  temp_terms_map[eResiduals]=temporary_terms_res;
-  temp_terms_map[eFirstDeriv]=temporary_terms_g1;
-  temp_terms_map[eSecondDeriv]=temporary_terms_g2;
-  temp_terms_map[eThirdDeriv]=temporary_terms_g3;
+  temp_terms_map[eResiduals] = temporary_terms_res;
+  temp_terms_map[eFirstDeriv] = temporary_terms_g1;
+  temp_terms_map[eSecondDeriv] = temporary_terms_g2;
+  temp_terms_map[eThirdDeriv] = temporary_terms_g3;
 
   for (vector<BinaryOpNode *>::iterator it = equations.begin();
        it != equations.end(); it++)
@@ -1332,17 +1332,17 @@ ModelTree::compileTemporaryTerms(ostream &code_file, unsigned int &instruction_n
           (*it)->compileExternalFunctionOutput(code_file, instruction_number, false, tt2, map_idx, dynamic, steady_dynamic, tef_terms);
         }
 
-      FNUMEXPR_ fnumexpr(TemporaryTerm, (int) (map_idx.find((*it)->idx)->second));
+      FNUMEXPR_ fnumexpr(TemporaryTerm, (int)(map_idx.find((*it)->idx)->second));
       fnumexpr.write(code_file, instruction_number);
       (*it)->compile(code_file, instruction_number, false, tt2, map_idx, dynamic, steady_dynamic, tef_terms);
       if (dynamic)
         {
-          FSTPT_ fstpt((int) (map_idx.find((*it)->idx)->second));
+          FSTPT_ fstpt((int)(map_idx.find((*it)->idx)->second));
           fstpt.write(code_file, instruction_number);
         }
       else
         {
-          FSTPST_ fstpst((int) (map_idx.find((*it)->idx)->second));
+          FSTPST_ fstpst((int)(map_idx.find((*it)->idx)->second));
           fstpst.write(code_file, instruction_number);
         }
       // Insert current node into tt2
@@ -1577,7 +1577,7 @@ ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output
       bool wrote_eq_tag = false;
       if (write_equation_tags)
         {
-          for (vector<pair<int,pair<string,string> > >::const_iterator iteqt = equation_tags.begin();
+          for (vector<pair<int, pair<string, string> > >::const_iterator iteqt = equation_tags.begin();
                iteqt != equation_tags.end(); iteqt++)
             if (iteqt->first == eq)
               {
@@ -1792,11 +1792,11 @@ ModelTree::computeParamsDerivativesTemporaryTerms()
   map<expr_t, pair<int, NodeTreeReference > > reference_count;
   params_derivs_temporary_terms.clear();
   map<NodeTreeReference, temporary_terms_t> temp_terms_map;
-  temp_terms_map[eResidualsParamsDeriv]=params_derivs_temporary_terms_res;
-  temp_terms_map[eJacobianParamsDeriv]=params_derivs_temporary_terms_g1;
-  temp_terms_map[eResidualsParamsSecondDeriv]=params_derivs_temporary_terms_res2;
-  temp_terms_map[eJacobianParamsSecondDeriv]=params_derivs_temporary_terms_g12;
-  temp_terms_map[eHessianParamsDeriv]=params_derivs_temporary_terms_g2;
+  temp_terms_map[eResidualsParamsDeriv] = params_derivs_temporary_terms_res;
+  temp_terms_map[eJacobianParamsDeriv] = params_derivs_temporary_terms_g1;
+  temp_terms_map[eResidualsParamsSecondDeriv] = params_derivs_temporary_terms_res2;
+  temp_terms_map[eJacobianParamsSecondDeriv] = params_derivs_temporary_terms_g12;
+  temp_terms_map[eHessianParamsDeriv] = params_derivs_temporary_terms_g2;
 
   for (first_derivatives_t::iterator it = residuals_params_derivatives.begin();
        it != residuals_params_derivatives.end(); it++)
@@ -1839,9 +1839,9 @@ ModelTree::computeParamsDerivativesTemporaryTerms()
   params_derivs_temporary_terms_g2   = temp_terms_map[eHessianParamsDeriv];
 }
 
-bool ModelTree::isNonstationary(int symb_id) const
+bool
+ModelTree::isNonstationary(int symb_id) const
 {
   return (nonstationary_symbols_map.find(symb_id)
           != nonstationary_symbols_map.end());
 }
-
diff --git a/ModelTree.hh b/ModelTree.hh
index 1de07d4b353d9516478289bd29c85762a75dc59c..f3c34836480b1fe8d7fa35b41306879e13e999a7 100644
--- a/ModelTree.hh
+++ b/ModelTree.hh
@@ -128,7 +128,6 @@ protected:
   */
   third_derivatives_t hessian_params_derivatives;
 
-
   //! Temporary terms for the static/dynamic file (those which will be noted Txxxx)
   temporary_terms_t temporary_terms;
   temporary_terms_t temporary_terms_res;
@@ -144,7 +143,6 @@ protected:
   temporary_terms_t params_derivs_temporary_terms_g12;
   temporary_terms_t params_derivs_temporary_terms_g2;
 
-
   //! Trend variables and their growth factors
   map<int, expr_t> trend_symbols_map;
 
@@ -177,7 +175,7 @@ protected:
   void computeTemporaryTerms(bool is_matlab);
   //! Computes temporary terms for the file containing parameters derivatives
   void computeParamsDerivativesTemporaryTerms();
-//! Writes temporary terms
+  //! Writes temporary terms
   void writeTemporaryTerms(const temporary_terms_t &tt, const temporary_terms_t &ttm1, ostream &output, ExprNodeOutputType output_type, deriv_node_temp_terms_t &tef_terms) const;
   //! Compiles temporary terms
   void compileTemporaryTerms(ostream &code_file, unsigned int &instruction_number, const temporary_terms_t &tt, map_idx_t map_idx, bool dynamic, bool steady_dynamic) const;
@@ -268,11 +266,12 @@ protected:
   virtual unsigned int getBlockMaxLag(int block_number) const = 0;
   //! Return the maximum lead in a block
   virtual unsigned int getBlockMaxLead(int block_number) const = 0;
-  inline void setBlockLeadLag(int block, int max_lag, int max_lead) 
-    {
-       block_lag_lead[block] = make_pair(max_lag, max_lead);
-    };
-  
+  inline void
+  setBlockLeadLag(int block, int max_lag, int max_lead)
+  {
+    block_lag_lead[block] = make_pair(max_lag, max_lead);
+  };
+
   //! Return the type of equation (equation_number) belonging to the block block_number
   virtual EquationType getBlockEquationType(int block_number, int equation_number) const = 0;
   //! Return true if the equation has been normalized
diff --git a/ParsingDriver.cc b/ParsingDriver.cc
index a7e81352c01403388682d7d43987089997242949..d3c05fb84e83d59651fcf86c151555862377123c 100644
--- a/ParsingDriver.cc
+++ b/ParsingDriver.cc
@@ -134,7 +134,7 @@ ParsingDriver::create_error_string(const Dynare::parser::location_type &l, const
       stream << ", cols " << l.begin.column << "-" << l.end.column - 1;
   else
     stream << ", col " << l.begin.column << " -"
-         << " line " << l.end.line << ", col " << l.end.column - 1;
+           << " line " << l.end.line << ", col " << l.end.column - 1;
   stream << ": " << m << endl;
 }
 
@@ -202,8 +202,8 @@ ParsingDriver::declare_var_endogenous(string *name)
     {
       SymbolType type = mod_file->symbol_table.getType(*name);
       if (type != eEndogenous && type != eExogenous && type != eExogenousDet)
-        error("Symbol " + *name + " used in a VAR must be either endogenous or " +
-              "exogenous if it is also used elsewhere in the .mod file");
+        error("Symbol " + *name + " used in a VAR must be either endogenous or "
+              +"exogenous if it is also used elsewhere in the .mod file");
       add_in_symbol_list(name);
       return;
     }
@@ -276,8 +276,8 @@ void
 ParsingDriver::declare_statement_local_variable(string *name)
 {
   if (mod_file->symbol_table.exists(*name))
-    error("Symbol " + *name + " cannot be assigned within a statement " +
-          "while being assigned elsewhere in the modfile");
+    error("Symbol " + *name + " cannot be assigned within a statement "
+          +"while being assigned elsewhere in the modfile");
   declare_symbol(name, eStatementDeclaredVariable, NULL, NULL);
   delete name;
 }
@@ -383,7 +383,7 @@ ParsingDriver::add_model_variable(string *name)
     {
       // This could be endog or param too. Just declare something to continue parsing,
       // knowing that processing will end at the end of parsing of the model block
-      declare_exogenous(new string (*name));
+      declare_exogenous(new string(*name));
       undeclared_model_vars.insert(*name);
       symb_id = mod_file->symbol_table.getID(*name);
     }
@@ -558,7 +558,7 @@ ParsingDriver::add_VAR_restriction_equation_or_crossequation(string *numberstr)
   double number = atof(numberstr->c_str());
   if (var_restriction_eq_or_crosseq.size() == 1)
     var_restriction_equation_or_crossequation = make_pair(make_pair(var_restriction_eq_or_crosseq[0],
-                                                                    make_pair(make_pair(-1, make_pair(-1, -1)), (expr_t)NULL)),
+                                                                    make_pair(make_pair(-1, make_pair(-1, -1)), (expr_t) NULL)),
                                                           number);
   else
     var_restriction_equation_or_crossequation = make_pair(make_pair(var_restriction_eq_or_crosseq[0],
@@ -918,7 +918,7 @@ ParsingDriver::add_det_shock(string *var, bool conditional_forecast)
     }
 
   det_shocks[symb_id] = v;
-  
+
   det_shocks_periods.clear();
   det_shocks_values.clear();
   delete var;
@@ -1054,7 +1054,7 @@ ParsingDriver::end_svar_identification()
   mod_file->addStatement(new SvarIdentificationStatement(svar_ident_restrictions,
                                                          svar_upper_cholesky,
                                                          svar_lower_cholesky,
-							 svar_constants_exclusion,
+                                                         svar_constants_exclusion,
                                                          mod_file->symbol_table));
   svar_restriction_symbols.clear();
   svar_equation_restrictions.clear();
@@ -1076,19 +1076,19 @@ ParsingDriver::combine_lag_and_restriction(string *lag)
   for (map<int, vector<int> >::const_iterator it = svar_equation_restrictions.begin();
        it != svar_equation_restrictions.end(); it++)
     for (vector<int>::const_iterator it1 = it->second.begin();
-	 it1 != it->second.end(); it1++)
+         it1 != it->second.end(); it1++)
       {
-	SvarIdentificationStatement::svar_identification_restriction new_restriction;
-	new_restriction.equation = it->first;
-	if (current_lag > 0)
-	  new_restriction.restriction_nbr = ++svar_Ri_restriction_nbr[it->first];
-	else
-	  new_restriction.restriction_nbr = ++svar_Qi_restriction_nbr[it->first];
-	new_restriction.lag = current_lag;
-	new_restriction.variable = *it1;
-	new_restriction.value = data_tree->One;
-	svar_ident_restrictions.push_back(new_restriction);
-      } 
+        SvarIdentificationStatement::svar_identification_restriction new_restriction;
+        new_restriction.equation = it->first;
+        if (current_lag > 0)
+          new_restriction.restriction_nbr = ++svar_Ri_restriction_nbr[it->first];
+        else
+          new_restriction.restriction_nbr = ++svar_Qi_restriction_nbr[it->first];
+        new_restriction.lag = current_lag;
+        new_restriction.variable = *it1;
+        new_restriction.value = data_tree->One;
+        svar_ident_restrictions.push_back(new_restriction);
+      }
   //    svar_ident_exclusion_values[make_pair(current_lag, it->first)] = it->second;
 
   svar_upper_cholesky = false;
@@ -1128,7 +1128,7 @@ ParsingDriver::add_in_svar_restriction_symbols(string *tmp_var)
   delete tmp_var;
 }
 
-void 
+void
 ParsingDriver::add_restriction_equation_nbr(string *eq_nbr)
 {
   svar_equation_nbr = atoi(eq_nbr->c_str());
@@ -1152,14 +1152,14 @@ ParsingDriver::add_positive_restriction_element(expr_t value, string *variable,
   // if the expression is not on the left handside, change its sign
   if (!svar_left_handside)
     value = add_uminus(value);
-  
+
   add_restriction_element(value, variable, lag);
 }
 
 void
 ParsingDriver::add_positive_restriction_element(string *variable, string *lag)
 {
-  expr_t value(data_tree->One); 
+  expr_t value(data_tree->One);
 
   // if the expression is not on the left handside, change its sign
   if (!svar_left_handside)
@@ -1181,7 +1181,7 @@ ParsingDriver::add_negative_restriction_element(expr_t value, string *variable,
 void
 ParsingDriver::add_negative_restriction_element(string *variable, string *lag)
 {
-  expr_t value(data_tree->One); 
+  expr_t value(data_tree->One);
 
   // if the expression is on the left handside, change its sign
   if (svar_left_handside)
@@ -1200,21 +1200,21 @@ ParsingDriver::add_restriction_element(expr_t value, string *variable, string *l
   if (svar_restriction_type == ParsingDriver::NOT_SET)
     {
       if (current_lag == 0)
-	{
-	  svar_restriction_type = ParsingDriver::Qi_TYPE;
-	  ++svar_Qi_restriction_nbr[svar_equation_nbr];
-	}
+        {
+          svar_restriction_type = ParsingDriver::Qi_TYPE;
+          ++svar_Qi_restriction_nbr[svar_equation_nbr];
+        }
       else
-	{
-	  svar_restriction_type = ParsingDriver::Ri_TYPE;
-	  ++svar_Ri_restriction_nbr[svar_equation_nbr];
-	}
+        {
+          svar_restriction_type = ParsingDriver::Ri_TYPE;
+          ++svar_Ri_restriction_nbr[svar_equation_nbr];
+        }
     }
   else
     {
       if ((svar_restriction_type == Qi_TYPE && current_lag > 0)
-	  || (svar_restriction_type == Ri_TYPE && current_lag == 0))
-	error("SVAR_IDENTIFICATION: a single restrictions must affect either Qi or Ri, but not both");
+          || (svar_restriction_type == Ri_TYPE && current_lag == 0))
+        error("SVAR_IDENTIFICATION: a single restrictions must affect either Qi or Ri, but not both");
     }
   SvarIdentificationStatement::svar_identification_restriction new_restriction;
   new_restriction.equation = svar_equation_nbr;
@@ -1379,7 +1379,7 @@ ParsingDriver::option_symbol_list(const string &name_option)
       != options_list.symbol_list_options.end())
     error("option " + name_option + " declared twice");
 
-  if (name_option.compare("irf_shocks")==0)
+  if (name_option.compare("irf_shocks") == 0)
     {
       vector<string> shocks = symbol_list.get_symbols();
       for (vector<string>::const_iterator it = shocks.begin();
@@ -1388,7 +1388,7 @@ ParsingDriver::option_symbol_list(const string &name_option)
           error("Variables passed to irf_shocks must be exogenous. Caused by: " + *it);
     }
 
-  if (name_option.compare("ms.parameters")==0)
+  if (name_option.compare("ms.parameters") == 0)
     {
       vector<string> parameters = symbol_list.get_symbols();
       for (vector<string>::const_iterator it = parameters.begin();
@@ -1594,7 +1594,7 @@ ParsingDriver::copy_subsamples(string *to_name1, string *to_name2, string *from_
   if (!from_name2->empty())
     check_symbol_existence(*from_name2);
 
-  if (subsample_declarations.find(make_pair(*from_name1,*from_name2)) == subsample_declarations.end())
+  if (subsample_declarations.find(make_pair(*from_name1, *from_name2)) == subsample_declarations.end())
     {
       string err = *from_name1;
       if (!from_name2->empty())
@@ -1605,8 +1605,8 @@ ParsingDriver::copy_subsamples(string *to_name1, string *to_name2, string *from_
   mod_file->addStatement(new SubsamplesEqualStatement(*to_name1, *to_name2, *from_name1, *from_name2,
                                                       mod_file->symbol_table));
 
-  subsample_declarations[make_pair(*to_name1, *to_name2)] =
-    subsample_declarations[make_pair(*from_name1, *from_name2)];
+  subsample_declarations[make_pair(*to_name1, *to_name2)]
+    = subsample_declarations[make_pair(*from_name1, *from_name2)];
 
   delete to_name1;
   delete to_name2;
@@ -1640,7 +1640,7 @@ ParsingDriver::check_subsample_declaration_exists(string *name1, string *subsamp
   if (subsample_name->empty())
     return;
 
-  string *str_empty = new string ("");
+  string *str_empty = new string("");
   check_subsample_declaration_exists(name1, str_empty, subsample_name);
   delete str_empty;
 }
@@ -1653,13 +1653,13 @@ ParsingDriver::check_subsample_declaration_exists(string *name1, string *name2,
 
   check_symbol_existence(*name1);
   if (!name2->empty())
-      check_symbol_existence(*name2);
+    check_symbol_existence(*name2);
 
   subsample_declarations_t::const_iterator it = subsample_declarations.find(make_pair(*name1, *name2));
   if (it == subsample_declarations.end())
     {
       it = subsample_declarations.find(make_pair(*name2, *name1));
-      if (it== subsample_declarations.end())
+      if (it == subsample_declarations.end())
         {
           string err = *name1;
           if (!name2->empty())
@@ -1673,7 +1673,6 @@ ParsingDriver::check_subsample_declaration_exists(string *name1, string *name2,
     error("The subsample name " + *subsample_name + " was not previously declared in a subsample statement.");
 }
 
-
 void
 ParsingDriver::set_prior(string *name, string *subsample_name)
 {
@@ -1688,9 +1687,9 @@ ParsingDriver::set_prior(string *name, string *subsample_name)
 }
 
 void
-ParsingDriver::set_joint_prior(vector<string *>*symbol_vec)
+ParsingDriver::set_joint_prior(vector<string *> *symbol_vec)
 {
-  for (vector<string *>::const_iterator it=symbol_vec->begin(); it != symbol_vec->end(); it++)
+  for (vector<string *>::const_iterator it = symbol_vec->begin(); it != symbol_vec->end(); it++)
     add_joint_parameter(*it);
   mod_file->addStatement(new JointPriorStatement(joint_parameters, prior_shape, options_list));
   joint_parameters.clear();
@@ -1800,7 +1799,7 @@ ParsingDriver::check_symbol_is_endogenous_or_exogenous(string *name)
 {
   check_symbol_existence(*name);
   int symb_id = mod_file->symbol_table.getID(*name);
-  switch(mod_file->symbol_table.getType(symb_id))
+  switch (mod_file->symbol_table.getType(symb_id))
     {
     case eEndogenous:
     case eExogenous:
@@ -2231,7 +2230,7 @@ ParsingDriver::ms_compute_probabilities()
 void
 ParsingDriver::ms_irf()
 {
-  mod_file->addStatement(new MSSBVARIrfStatement(symbol_list,options_list));
+  mod_file->addStatement(new MSSBVARIrfStatement(symbol_list, options_list));
   symbol_list.clear();
   options_list.clear();
 }
@@ -2396,7 +2395,7 @@ ParsingDriver::add_model_equal(expr_t arg1, expr_t arg2)
   expr_t id = model_tree->AddEqual(arg1, arg2);
 
   // Detect if the equation is tagged [static]
-  bool is_static_only = false;  
+  bool is_static_only = false;
   for (vector<pair<string, string> >::const_iterator it = eq_tags.begin();
        it != eq_tags.end(); ++it)
     if (it->first == "static")
@@ -2409,7 +2408,7 @@ ParsingDriver::add_model_equal(expr_t arg1, expr_t arg2)
     {
       if (!id->isInStaticForm())
         error("An equation tagged [static] cannot contain leads, lags, expectations or STEADY_STATE operators");
-      
+
       dynamic_model->addStaticOnlyEquation(id, location.begin.line);
     }
   else
@@ -2913,7 +2912,7 @@ ParsingDriver::add_model_var_or_external_function(string *function_name, bool in
           if (rv.first)
             {
               // assume it's a lead/lagged variable
-              declare_exogenous(new string (*function_name));
+              declare_exogenous(new string(*function_name));
               return add_model_variable(mod_file->symbol_table.getID(*function_name), (int) rv.second);
             }
           else
@@ -3078,18 +3077,19 @@ ParsingDriver::add_moment_calibration_item(string *endo1, string *endo2, string
 
   c.lags = *lags;
   delete lags;
-  
+
   assert(range->size() == 2);
   c.lower_bound = *((*range)[0]);
   c.upper_bound = *((*range)[1]);
   delete (*range)[0];
   delete (*range)[1];
   delete range;
-  
+
   moment_calibration_constraints.push_back(c);
 }
 
-void ParsingDriver::end_moment_calibration()
+void
+ParsingDriver::end_moment_calibration()
 {
   mod_file->addStatement(new MomentCalibration(moment_calibration_constraints,
                                                mod_file->symbol_table));
@@ -3115,18 +3115,19 @@ ParsingDriver::add_irf_calibration_item(string *endo, string *periods, string *e
   if (mod_file->symbol_table.getType(*exo) != eExogenous)
     error("Variable " + *endo + " is not an exogenous.");
   delete exo;
-  
+
   assert(range->size() == 2);
   c.lower_bound = *((*range)[0]);
   c.upper_bound = *((*range)[1]);
   delete (*range)[0];
   delete (*range)[1];
   delete range;
-  
+
   irf_calibration_constraints.push_back(c);
 }
 
-void ParsingDriver::end_irf_calibration()
+void
+ParsingDriver::end_irf_calibration()
 {
   mod_file->addStatement(new IrfCalibration(irf_calibration_constraints,
                                             mod_file->symbol_table,
@@ -3148,7 +3149,6 @@ ParsingDriver::histval_file(string *filename)
   delete filename;
 }
 
-
 void
 ParsingDriver::perfect_foresight_setup()
 {
@@ -3166,7 +3166,7 @@ ParsingDriver::perfect_foresight_solver()
 void
 ParsingDriver::prior_posterior_function(bool prior_func)
 {
-  mod_file->addStatement(new PriorPosteriorFunctionStatement((bool)prior_func, options_list));
+  mod_file->addStatement(new PriorPosteriorFunctionStatement((bool) prior_func, options_list));
   options_list.clear();
 }
 
@@ -3180,25 +3180,25 @@ ParsingDriver::add_ramsey_constraints_statement()
 void
 ParsingDriver::ramsey_constraint_add_less(const string *name, const expr_t rhs)
 {
-  add_ramsey_constraint(name,oLess,rhs);
+  add_ramsey_constraint(name, oLess, rhs);
 }
 
 void
 ParsingDriver::ramsey_constraint_add_greater(const string *name, const expr_t rhs)
 {
-  add_ramsey_constraint(name,oGreater,rhs);
+  add_ramsey_constraint(name, oGreater, rhs);
 }
 
 void
 ParsingDriver::ramsey_constraint_add_less_equal(const string *name, const expr_t rhs)
 {
-  add_ramsey_constraint(name,oLessEqual,rhs);
+  add_ramsey_constraint(name, oLessEqual, rhs);
 }
 
 void
 ParsingDriver::ramsey_constraint_add_greater_equal(const string *name, const expr_t rhs)
 {
-  add_ramsey_constraint(name,oGreaterEqual,rhs);
+  add_ramsey_constraint(name, oGreaterEqual, rhs);
 }
 
 void
@@ -3235,7 +3235,6 @@ ParsingDriver::add_shock_group_element(string *name)
   delete name;
 }
 
-
 void
 ParsingDriver::add_shock_group(string *name)
 {
diff --git a/ParsingDriver.hh b/ParsingDriver.hh
index a54407c2a73db58d537c99fea2b603194092591d..9d3eb46a094171c67e00d9927cbfd402e4a33d9f 100644
--- a/ParsingDriver.hh
+++ b/ParsingDriver.hh
@@ -171,7 +171,7 @@ private:
   map<int, vector<int> > svar_equation_restrictions;
   //! Temporary storage for restrictions in an equation within an svar_identification block
   vector<int> svar_restriction_symbols;
-  //! Temporary storage for constants exculsion within an svar_identification 
+  //! Temporary storage for constants exculsion within an svar_identification
   bool svar_constants_exclusion;
   //! Temporary storage for upper cholesky within an svar_identification block
   bool svar_upper_cholesky;
@@ -182,8 +182,8 @@ private:
   //! Temporary storage for left/right handside of a restriction equation within an svar_identificaton block
   bool svar_left_handside;
   //! Temporary storage for current restriction number in svar_identification block
-  map<int,int> svar_Qi_restriction_nbr;
-  map<int,int> svar_Ri_restriction_nbr;
+  map<int, int> svar_Qi_restriction_nbr;
+  map<int, int> svar_Ri_restriction_nbr;
   //! Stores undeclared model variables
   set<string> undeclared_model_vars;
   //! Temporary storage for restriction type
@@ -244,7 +244,9 @@ private:
   //! Used by VAR restrictions
   void clear_VAR_storage();
 public:
-  ParsingDriver(WarningConsolidation &warnings_arg, bool nostrict_arg) : warnings(warnings_arg), nostrict(nostrict_arg), model_error_encountered(false) { };
+  ParsingDriver(WarningConsolidation &warnings_arg, bool nostrict_arg) : warnings(warnings_arg), nostrict(nostrict_arg), model_error_encountered(false)
+  {
+  };
 
   //! Starts parsing, and constructs the MOD file representation
   /*! The returned pointer should be deleted after use */
@@ -473,11 +475,11 @@ public:
   //! Sets the prior for a parameter
   void set_prior(string *arg1, string *arg2);
   //! Sets the joint prior for a set of parameters
-  void set_joint_prior(vector<string *>*symbol_vec);
+  void set_joint_prior(vector<string *> *symbol_vec);
   //! Adds a parameters to the list of joint parameters
   void add_joint_parameter(string *name);
   //! Adds the variance option to its temporary holding place
-  void set_prior_variance(expr_t variance=NULL);
+  void set_prior_variance(expr_t variance = NULL);
   //! Copies the prior from_name to_name
   void copy_prior(string *to_declaration_type, string *to_name1, string *to_name2, string *to_subsample_name,
                   string *from_declaration_type, string *from_name1, string *from_name2, string *from_subsample_name);
@@ -492,7 +494,7 @@ public:
   void set_std_options(string *arg1, string *arg2);
   //! Sets the prior for estimated correlation
   void set_corr_prior(string *arg1, string *arg2, string *arg3);
- //! Sets the options for estimated correlation
+  //! Sets the options for estimated correlation
   void set_corr_options(string *arg1, string *arg2, string *arg3);
   //! Runs estimation process
   void run_estimation();
@@ -529,11 +531,11 @@ public:
   void add_restriction_equation_nbr(string *eq_nbr);
   //! Svar_Identification Statement: record presence of equal sign
   void add_restriction_equal();
-  //! Svar_Idenditification Statement: add coefficient of a linear restriction (positive value) 
+  //! Svar_Idenditification Statement: add coefficient of a linear restriction (positive value)
   void add_positive_restriction_element(expr_t value, string *variable, string *lag);
-  //! Svar_Idenditification Statement: add unit coefficient of a linear restriction 
+  //! Svar_Idenditification Statement: add unit coefficient of a linear restriction
   void add_positive_restriction_element(string *variable, string *lag);
-  //! Svar_Idenditification Statement: add coefficient of a linear restriction (negative value) 
+  //! Svar_Idenditification Statement: add coefficient of a linear restriction (negative value)
   void add_negative_restriction_element(expr_t value, string *variable, string *lag);
   //! Svar_Idenditification Statement: add negative unit coefficient of a linear restriction
   void add_negative_restriction_element(string *variable, string *lag);
@@ -562,7 +564,7 @@ public:
   void run_load_params_and_steady_state(string *filename);
   void run_save_params_and_steady_state(string *filename);
   void run_identification();
-  void add_mc_filename(string *filename, string *prior = new string("1"));
+  void add_mc_filename(string *filename, string *prior = new string ("1"));
   void run_model_comparison();
   //! Begin a planner_objective statement
   void begin_planner_objective();
diff --git a/Shocks.cc b/Shocks.cc
index af40262414e6dc343874707a73d11814580c7590..0aa7fdfa601605ed3079fcd1904f213472d6bc86 100644
--- a/Shocks.cc
+++ b/Shocks.cc
@@ -94,9 +94,9 @@ ShocksStatement::writeOutput(ostream &output, const string &basename, bool minim
       output << "M_.det_shocks = [];" << endl;
 
       output << "M_.Sigma_e = zeros(" << symbol_table.exo_nbr() << ", "
-              << symbol_table.exo_nbr() << ");" << endl
-              << "M_.Correlation_matrix = eye(" << symbol_table.exo_nbr() << ", "
-              << symbol_table.exo_nbr() << ");" << endl;
+             << symbol_table.exo_nbr() << ");" << endl
+             << "M_.Correlation_matrix = eye(" << symbol_table.exo_nbr() << ", "
+             << symbol_table.exo_nbr() << ");" << endl;
 
       if (has_calibrated_measurement_errors())
         output << "M_.H = zeros(" << symbol_table.observedVariablesNbr() << ", "
@@ -254,7 +254,7 @@ ShocksStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidati
     {
       int symb_id1 = it->first.first;
       int symb_id2 = it->first.second;
-      
+
       if (!((symbol_table.getType(symb_id1) == eExogenous
              && symbol_table.getType(symb_id2) == eExogenous)
             || (symbol_table.isObservedVariable(symb_id1)
@@ -272,7 +272,7 @@ ShocksStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidati
     {
       int symb_id1 = it->first.first;
       int symb_id2 = it->first.second;
-      
+
       if (!((symbol_table.getType(symb_id1) == eExogenous
              && symbol_table.getType(symb_id2) == eExogenous)
             || (symbol_table.isObservedVariable(symb_id1)
@@ -465,7 +465,7 @@ ShockGroupsStatement::writeOutput(ostream &output, const string &basename, bool
 {
   int i = 1;
   bool unique_label = true;
-  for (vector<Group>::const_iterator it = shock_groups.begin(); it != shock_groups.end(); it++, unique_label=true)
+  for (vector<Group>::const_iterator it = shock_groups.begin(); it != shock_groups.end(); it++, unique_label = true)
     {
       for (vector<Group>::const_iterator it1 = it+1; it1 != shock_groups.end(); it1++)
         if (it->name == it1->name)
@@ -482,7 +482,7 @@ ShockGroupsStatement::writeOutput(ostream &output, const string &basename, bool
                  << ".group" << i << ".label = '" << it->name << "';" << endl
                  << "M_.shock_groups." << name
                  << ".group" << i << ".shocks = {";
-          for ( vector<string>::const_iterator it1 = it->list.begin(); it1 != it->list.end(); it1++)
+          for (vector<string>::const_iterator it1 = it->list.begin(); it1 != it->list.end(); it1++)
             output << " '" << *it1 << "'";
           output << "};" << endl;
           i++;
diff --git a/Shocks.hh b/Shocks.hh
index f89e1fba1ec51d035aa4707129c84c8e59720bb3..1c7abb9135935d1292e6d9cdb40d7626a02655a2 100644
--- a/Shocks.hh
+++ b/Shocks.hh
@@ -160,5 +160,5 @@ public:
   ShockGroupsStatement(const group_t &shock_groups_arg, const string &name_arg);
   virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
 };
-  
+
 #endif
diff --git a/Statement.cc b/Statement.cc
index d43d11444ee05b6c8d963cfc62d6f962b4f4dbe9..d1a34bd2cc158bffe279b5d7c6219b0ef7049de1 100644
--- a/Statement.cc
+++ b/Statement.cc
@@ -77,7 +77,8 @@ Statement::writeCOutput(ostream &output, const string &basename)
 {
 }
 
-void Statement::writeJuliaOutput(ostream &output, const string &basename)
+void
+Statement::writeJuliaOutput(ostream &output, const string &basename)
 {
 }
 
@@ -100,7 +101,7 @@ NativeStatement::writeOutput(ostream &output, const string &basename, bool minim
   sregex regex_dollar = sregex::compile("(\\$)"+date_regex);
 
   string ns = regex_replace(native_statement, regex_lookbehind, "dates('$&')");
-  ns = regex_replace(ns, regex_dollar, "$2" ); //replace $DATE with DATE
+  ns = regex_replace(ns, regex_dollar, "$2"); //replace $DATE with DATE
   output << ns << endl;
 }
 
@@ -161,9 +162,9 @@ OptionsList::writeOutput(ostream &output, const string &option_group) const
 {
   // Initialize option_group as an empty struct iff the field does not exist!
   unsigned idx = option_group.find_last_of(".");
-  if (idx<UINT_MAX)
+  if (idx < UINT_MAX)
     {
-      output << "if ~isfield(" << option_group.substr(0,idx) << ",'" << option_group.substr(idx+1) << "')" << endl;
+      output << "if ~isfield(" << option_group.substr(0, idx) << ",'" << option_group.substr(idx+1) << "')" << endl;
       output << "    " << option_group << " = struct();" << endl;
       output << "end" << endl;
     }
diff --git a/Statement.hh b/Statement.hh
index fa60a5459786d829039a53035a165802c4cb423f..d189f73ab7b73f1e121aca17e3ac9c6ebc61a3a8 100644
--- a/Statement.hh
+++ b/Statement.hh
@@ -117,14 +117,15 @@ public:
   bool occbin_option;
   //! Stores the original number of equations in the model_block
   int orig_eq_nbr;
-   //! Stores the number of equations added to the Ramsey model
+  //! Stores the number of equations added to the Ramsey model
   int ramsey_eq_nbr;
 };
 
 class Statement
 {
 public:
-  virtual ~Statement();
+  virtual
+  ~Statement();
   //! Do some internal check, and fill the ModFileStructure class
   /*! Don't forget to update ComputingTasks.hh, Shocks.hh and
     NumericalInitialization.hh if you modify the signature of this
diff --git a/StaticModel.cc b/StaticModel.cc
index 1d176027470005acbdb8eb460372ab8c656e43ce..1038ac5324ea78680faf314d00fd27cea17cc53f 100644
--- a/StaticModel.cc
+++ b/StaticModel.cc
@@ -661,10 +661,10 @@ StaticModel::writeModelEquationsCode_Block(const string file_name, const string
                   if (dynamic_cast<AbstractExternalFunctionNode *>(*it) != NULL)
                     (*it)->compileExternalFunctionOutput(code_file, instruction_number, false, tt2, map_idx, false, false, tef_terms);
 
-                  FNUMEXPR_ fnumexpr(TemporaryTerm, (int) (map_idx.find((*it)->idx)->second));
+                  FNUMEXPR_ fnumexpr(TemporaryTerm, (int)(map_idx.find((*it)->idx)->second));
                   fnumexpr.write(code_file, instruction_number);
                   (*it)->compile(code_file, instruction_number, false, tt2, map_idx, false, false, tef_terms);
-                  FSTPST_ fstpst((int) (map_idx.find((*it)->idx)->second));
+                  FSTPST_ fstpst((int)(map_idx.find((*it)->idx)->second));
                   fstpst.write(code_file, instruction_number);
                   // Insert current node into tt2
                   tt2.insert(*it);
@@ -854,12 +854,12 @@ StaticModel::writeModelEquationsCode_Block(const string file_name, const string
                   if (dynamic_cast<AbstractExternalFunctionNode *>(*it) != NULL)
                     (*it)->compileExternalFunctionOutput(code_file, instruction_number, false, tt3, map_idx2[block], false, false, tef_terms2);
 
-                  FNUMEXPR_ fnumexpr(TemporaryTerm, (int) (map_idx2[block].find((*it)->idx)->second));
+                  FNUMEXPR_ fnumexpr(TemporaryTerm, (int)(map_idx2[block].find((*it)->idx)->second));
                   fnumexpr.write(code_file, instruction_number);
 
                   (*it)->compile(code_file, instruction_number, false, tt3, map_idx2[block], false, false, tef_terms);
 
-                  FSTPST_ fstpst((int) (map_idx2[block].find((*it)->idx)->second));
+                  FSTPST_ fstpst((int)(map_idx2[block].find((*it)->idx)->second));
                   fstpst.write(code_file, instruction_number);
                   // Insert current node into tt2
                   tt3.insert(*it);
@@ -1058,14 +1058,14 @@ StaticModel::computingPass(const eval_context_t &eval_context, bool no_tmp_terms
       neweqs.push_back(dynamic_cast<BinaryOpNode *>(eq_tmp->toStatic(*this)));
     }
 
-  for (unsigned int eq = 0; eq < aux_equations.size();  eq++)
+  for (unsigned int eq = 0; eq < aux_equations.size(); eq++)
     {
       expr_t eq_tmp = aux_equations[eq]->substituteStaticAuxiliaryDefinition();
       neweqs.push_back(dynamic_cast<BinaryOpNode *>(eq_tmp->toStatic(*this)));
     }
-      
+
   equations.clear();
-  copy(neweqs.begin(),neweqs.end(),back_inserter(equations));
+  copy(neweqs.begin(), neweqs.end(), back_inserter(equations));
   // Compute derivatives w.r. to all endogenous, and possibly exogenous and exogenous deterministic
   set<int> vars;
 
@@ -1074,8 +1074,8 @@ StaticModel::computingPass(const eval_context_t &eval_context, bool no_tmp_terms
       int id = symbol_table.getID(eEndogenous, i);
       //      if (!symbol_table.isAuxiliaryVariableButNotMultiplier(id))
       vars.insert(getDerivID(id, 0));
-    }        
- 
+    }
+
   // Launch computations
   cout << "Computing static model derivatives:" << endl
        << " - order 1" << endl;
@@ -1190,7 +1190,7 @@ StaticModel::writeStaticMFile(const string &func_name) const
          << "%                                                       columns: variables in declaration order" << endl
          << "%                                                       rows: equations in order of declaration" << endl
          << "%" << endl
-         << "%" << endl         
+         << "%" << endl
          << "% Warning : this file is generated automatically by Dynare" << endl
          << "%           from model file (.mod)" << endl << endl;
 
@@ -1338,7 +1338,6 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
       int id2 = getSymbIDByDerivID(var2);
       int id3 = getSymbIDByDerivID(var3);
 
-
       // Reference column number for the g3 matrix
       int ref_col = id1 * hessianColsNbr + id2 * JacobianColsNbr + id3;
 
@@ -1440,15 +1439,15 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
 
       // Initialize g3 matrix
       StaticOutput << "if nargout >= 4," << endl
-                    << "  %" << endl
-                    << "  % Third order derivatives" << endl
-                    << "  %" << endl
-                    << endl;
+                   << "  %" << endl
+                   << "  % Third order derivatives" << endl
+                   << "  %" << endl
+                   << endl;
       int ncols = hessianColsNbr * JacobianColsNbr;
       if (third_derivatives.size())
         StaticOutput << "  v3 = zeros(" << NNZDerivatives[2] << ",3);" << endl
-                      << third_derivatives_output.str()
-                      << "  g3 = sparse(v3(:,1),v3(:,2),v3(:,3)," << nrows << "," << ncols << ");" << endl;
+                     << third_derivatives_output.str()
+                     << "  g3 = sparse(v3(:,1),v3(:,2),v3(:,3)," << nrows << "," << ncols << ");" << endl;
       else // Either 3rd derivatives is all zero, or we didn't compute it
         StaticOutput << "  g3 = sparse([],[],[]," << nrows << "," << ncols << ");" << endl;
       StaticOutput << "end" << endl
@@ -1622,7 +1621,6 @@ StaticModel::writeStaticCFile(const string &func_name) const
   output << "#define max(a, b) (((a) > (b)) ? (a) : (b))" << endl
          << "#define min(a, b) (((a) > (b)) ? (b) : (a))" << endl;
 
-
   // Write function definition if oPowerDeriv is used
   writePowerDerivCHeader(output);
   writeNormcdfCHeader(output);
@@ -1754,7 +1752,7 @@ StaticModel::writeStaticFile(const string &basename, bool block, bool bytecode,
       chdir("..");
       writeStaticBlockMFSFile(basename);
     }
-  else if(use_dll)
+  else if (use_dll)
     writeStaticCFile(basename);
   else if (julia)
     writeStaticJuliaFile(basename);
@@ -1859,7 +1857,7 @@ StaticModel::writeOutput(ostream &output, bool block) const
   for (int i = 0; i < nb_endo; i++)
     output << " " << equation_reordered[i]+1;
   output << "];\n";
-  
+
   map<pair<int, int>,  int>  row_incidence;
   for (first_derivatives_t::const_iterator it = first_derivatives.begin();
        it != first_derivatives.end(); it++)
@@ -2129,9 +2127,10 @@ StaticModel::writeAuxVarInitval(ostream &output, ExprNodeOutputType output_type)
     }
 }
 
-void StaticModel::writeSetAuxiliaryVariables(const string &basename, const bool julia) const
+void
+StaticModel::writeSetAuxiliaryVariables(const string &basename, const bool julia) const
 {
-  
+
   string func_name = basename + "_set_auxiliary_variables";
   string filename = julia ? func_name + ".jl" : func_name + ".m";
   string comment = julia ? "#" : "%";
@@ -2311,7 +2310,6 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
       third_derivs1_output << ";" << endl;
     }
 
-
   ofstream paramsDerivsFile;
   string filename = julia ? basename + "StaticParamsDerivs.jl" : basename + "_static_params_derivs.m";
   paramsDerivsFile.open(filename.c_str(), ios::out | ios::binary);
diff --git a/StaticModel.hh b/StaticModel.hh
index 8535a714077f900d0b1a156d5796506c77abdf46..abf2aa01b29f17c763dffc4a9b6cae525679565e 100644
--- a/StaticModel.hh
+++ b/StaticModel.hh
@@ -215,12 +215,14 @@ public:
     return (block_type_firstequation_size_mfs[block_number].second.first);
   };
   //! Return the number of exogenous variable in the block block_number
-  virtual unsigned int getBlockExoSize(int block_number) const
+  virtual unsigned int
+  getBlockExoSize(int block_number) const
   {
     return 0;
   };
   //! Return the number of colums in the jacobian matrix for exogenous variable in the block block_number
-  virtual unsigned int getBlockExoColSize(int block_number) const
+  virtual unsigned int
+  getBlockExoColSize(int block_number) const
   {
     return 0;
   }
diff --git a/SteadyStateModel.cc b/SteadyStateModel.cc
index 7630823ff9387a5087a90c03f36e05dd5390437c..5fc9dc1de01da099628361f47fe6b6a58fa68adf 100644
--- a/SteadyStateModel.cc
+++ b/SteadyStateModel.cc
@@ -72,7 +72,7 @@ SteadyStateModel::checkPass(bool ramsey_model, WarningConsolidation &warnings) c
         if (find(so_far_defined.begin(), so_far_defined.end(), symb_ids[j])
             != so_far_defined.end())
           warnings << "WARNING: in the 'steady_state_model' block, variable '" << symbol_table.getName(symb_ids[j]) << "' is declared twice" << endl;
-      
+
       // Check that expression has no undefined symbol
       if (!ramsey_model)
         {
@@ -187,15 +187,15 @@ SteadyStateModel::writeSteadyStateFileC(const string &basename, bool ramsey_mode
   output << "#include <math.h>" << endl;
 
   output << "void steadystate("
-	 << "const double *exo_, const double *params, double *ys_, int *info)" << endl
+         << "const double *exo_, const double *params, double *ys_, int *info)" << endl
          << "// Steady state file generated by Dynare preprocessor" << endl
-	 << "{" << endl
+         << "{" << endl
          << "    *info = 0;" << endl;
 
   if (def_table.size() == 0)
     {
       output << "    return;" << endl
-	     << "}" << endl;
+             << "}" << endl;
       return;
     }
 
@@ -204,11 +204,11 @@ SteadyStateModel::writeSteadyStateFileC(const string &basename, bool ramsey_mode
       const vector<int> &symb_ids = def_table[i].first;
       output << "    ";
       if (symb_ids.size() > 1)
-	std::cout << "Error: in C, multiple returns are not permitted in steady_state_model" << std::endl;
+        std::cout << "Error: in C, multiple returns are not permitted in steady_state_model" << std::endl;
       variable_node_map_t::const_iterator it = variable_node_map.find(make_pair(symb_ids[0], 0));
       assert(it != variable_node_map.end());
       if (it->second->get_type() == eModFileLocalVariable)
-	output << "double ";
+        output << "double ";
       dynamic_cast<ExprNode *>(it->second)->writeOutput(output, oCSteadyStateFile);
       output << "=";
       def_table[i].second->writeOutput(output, oCSteadyStateFile);
diff --git a/SymbolList.hh b/SymbolList.hh
index 988c984eb82b4def0f1cf99ac470ed50bec9feee..b29f459636a21d18d4417709b51a726d957830cc 100644
--- a/SymbolList.hh
+++ b/SymbolList.hh
@@ -44,9 +44,17 @@ public:
   //! Clears all content
   void clear();
   //! Get a copy of the string vector
-  vector<string> get_symbols() const { return symbols; };
+  vector<string>
+  get_symbols() const
+  {
+    return symbols;
+  };
   //! Is Empty
-  int empty() const { return symbols.empty(); };
+  int
+  empty() const
+  {
+    return symbols.empty();
+  };
   //! Return the number of Symbols contained in the list
   int getSize() const;
   //! Return the list of symbols
diff --git a/SymbolTable.cc b/SymbolTable.cc
index 183c45c84872f70ec65d873aaf4db962a322919b..01a85ae26ae0cca0479060fa5bb4c0a295ea5b8d 100644
--- a/SymbolTable.cc
+++ b/SymbolTable.cc
@@ -42,7 +42,7 @@ SymbolTable::SymbolTable() : frozen(false), size(0)
 }
 
 int
-SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string * , string *> *> *partition_value) throw (AlreadyDeclaredException, FrozenException)
+SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string *, string *> *> *partition_value) throw (AlreadyDeclaredException, FrozenException)
 {
   if (frozen)
     throw FrozenException();
@@ -88,7 +88,7 @@ SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_na
     {
       map<string, string> pmv;
       for (vector<pair<string *, string *> *>::const_iterator it = partition_value->begin();
-       it != partition_value->end(); it++)
+           it != partition_value->end(); it++)
         pmv[*((*it)->first)] = *((*it)->second);
       partition_value_map[id] = pmv;
     }
@@ -216,7 +216,6 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException)
                << "M_.exo_names_tex = char(M_.exo_names_tex, '" << getTeXName(exo_ids[id]) << "');" << endl
                << "M_.exo_names_long = char(M_.exo_names_long, '" << getLongName(exo_ids[id]) << "');" << endl;
 
-
       map<string, map<int, string> > partitions = getPartitionsForType(eExogenous);
       for (map<string, map<int, string> >::const_iterator it = partitions.begin();
            it != partitions.end(); it++)
@@ -292,7 +291,7 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException)
                   output << it1->second;
                 output << "' ";
               }
-          output << "};" << endl;
+            output << "};" << endl;
           }
     }
 
@@ -424,7 +423,7 @@ SymbolTable::writeCOutput(ostream &output) const throw (NotYetFrozenException)
     {
       output << "char *exo_names[" << exo_nbr() << "];" << endl;
       for (int id = 0; id < exo_nbr(); id++)
-	output << "exo_names[" << id << "] = \"" << getName(exo_ids[id]) << "\";" << endl;
+        output << "exo_names[" << id << "] = \"" << getName(exo_ids[id]) << "\";" << endl;
     }
 
   output << endl
@@ -433,7 +432,7 @@ SymbolTable::writeCOutput(ostream &output) const throw (NotYetFrozenException)
     {
       output << "char *exo_det_names[" << exo_det_nbr() << "];" << endl;
       for (int id = 0; id < exo_det_nbr(); id++)
-	output << "exo_det_names[" << id << "] = \"" << getName(exo_det_ids[id]) << "\";" << endl;
+        output << "exo_det_names[" << id << "] = \"" << getName(exo_det_ids[id]) << "\";" << endl;
     }
 
   output << endl
@@ -442,7 +441,7 @@ SymbolTable::writeCOutput(ostream &output) const throw (NotYetFrozenException)
     {
       output << "char *endo_names[" << endo_nbr() << "];" << endl;
       for (int id = 0; id < endo_nbr(); id++)
-	output << "endo_names[" << id << "] = \"" << getName(endo_ids[id]) << "\";" << endl;
+        output << "endo_names[" << id << "] = \"" << getName(endo_ids[id]) << "\";" << endl;
     }
 
   output << endl
@@ -451,7 +450,7 @@ SymbolTable::writeCOutput(ostream &output) const throw (NotYetFrozenException)
     {
       output << "char *param_names[" << param_nbr() << "];" << endl;
       for (int id = 0; id < param_nbr(); id++)
-	output << "param_names[" << id << "] = \"" << getName(param_ids[id]) << "\";" << endl;
+        output << "param_names[" << id << "] = \"" << getName(param_ids[id]) << "\";" << endl;
     }
 
   // Write the auxiliary variable table
@@ -460,38 +459,38 @@ SymbolTable::writeCOutput(ostream &output) const throw (NotYetFrozenException)
     {
       output << "struct aux_vars_t *av[" << aux_vars.size() << "];" << endl;
       for (int i = 0; i < (int) aux_vars.size(); i++)
-	{
-	  output << "av[" << i << "].endo_index = " << getTypeSpecificID(aux_vars[i].get_symb_id()) << ";" << endl
-		 << "av[" << i << "].type = " << aux_vars[i].get_type() << ";" << endl;
-	  switch (aux_vars[i].get_type())
-	    {
-	    case avEndoLead:
-	    case avExoLead:
-	    case avExpectation:
-	    case avMultiplier:
-	    case avDiffForward:
-	      break;
-	    case avEndoLag:
-	    case avExoLag:
+        {
+          output << "av[" << i << "].endo_index = " << getTypeSpecificID(aux_vars[i].get_symb_id()) << ";" << endl
+                 << "av[" << i << "].type = " << aux_vars[i].get_type() << ";" << endl;
+          switch (aux_vars[i].get_type())
+            {
+            case avEndoLead:
+            case avExoLead:
+            case avExpectation:
+            case avMultiplier:
+            case avDiffForward:
+              break;
+            case avEndoLag:
+            case avExoLag:
             case avVarModel:
-	      output << "av[" << i << "].orig_index = " << getTypeSpecificID(aux_vars[i].get_orig_symb_id()) << ";" << endl
-		     << "av[" << i << "].orig_lead_lag = " << aux_vars[i].get_orig_lead_lag() << ";" << endl;
-	      break;
-	    }
-	}
+              output << "av[" << i << "].orig_index = " << getTypeSpecificID(aux_vars[i].get_orig_symb_id()) << ";" << endl
+                     << "av[" << i << "].orig_lead_lag = " << aux_vars[i].get_orig_lead_lag() << ";" << endl;
+              break;
+            }
+        }
     }
 
   output << "int predeterminedNbr = " << predeterminedNbr() << ";" << endl;
   if (predeterminedNbr() > 0)
     {
-      output << "int predetermined_variables[" << predeterminedNbr() << "] = {"; 
+      output << "int predetermined_variables[" << predeterminedNbr() << "] = {";
       for (set<int>::const_iterator it = predetermined_variables.begin();
-	   it != predetermined_variables.end(); it++)
-	{
-	  if ( it != predetermined_variables.begin() )
-	    output << ",";
-	  output << getTypeSpecificID(*it);
-	}
+           it != predetermined_variables.end(); it++)
+        {
+          if (it != predetermined_variables.begin())
+            output << ",";
+          output << getTypeSpecificID(*it);
+        }
       output << "};" << endl;
     }
 
@@ -500,13 +499,13 @@ SymbolTable::writeCOutput(ostream &output) const throw (NotYetFrozenException)
     {
       output << "int varobs[" << observedVariablesNbr() << "] = {";
       for (vector<int>::const_iterator it = varobs.begin();
-	   it != varobs.end(); it++)
-	{
-	  if ( it != varobs.begin() )
-	    output << ",";
-	  output << getTypeSpecificID(*it);
-	}
-      output  << "};" << endl;
+           it != varobs.end(); it++)
+        {
+          if (it != varobs.begin())
+            output << ",";
+          output << getTypeSpecificID(*it);
+        }
+      output << "};" << endl;
     }
 
   output << "int observedExogenousVariablesNbr = " << observedExogenousVariablesNbr() << ";" << endl;
@@ -514,13 +513,13 @@ SymbolTable::writeCOutput(ostream &output) const throw (NotYetFrozenException)
     {
       output << "int varexobs[" << observedExogenousVariablesNbr() << "] = {";
       for (vector<int>::const_iterator it = varexobs.begin();
-	   it != varexobs.end(); it++)
-	{
-	  if ( it != varexobs.begin() )
-	    output << ",";
-	  output << getTypeSpecificID(*it);
-	}
-      output  << "};" << endl;
+           it != varexobs.end(); it++)
+        {
+          if (it != varexobs.begin())
+            output << ",";
+          output << getTypeSpecificID(*it);
+        }
+      output << "};" << endl;
     }
 }
 
@@ -1029,25 +1028,25 @@ SymbolTable::writeJuliaOutput(ostream &output) const throw (NotYetFrozenExceptio
       output << "]" << endl;
     }
 
-    if (predeterminedNbr() > 0)
-      {
-        output << "# Predetermined Variables" << endl
-               << "model_.pred_vars = [ " << endl;
-        for (set<int>::const_iterator it = predetermined_variables.begin();
-             it != predetermined_variables.end(); it++)
-          output << "                   DynareModel.PredVars("
-                 << getTypeSpecificID(*it)+1 << ")" << endl;
-        output << "                  ]" << endl;
-      }
+  if (predeterminedNbr() > 0)
+    {
+      output << "# Predetermined Variables" << endl
+             << "model_.pred_vars = [ " << endl;
+      for (set<int>::const_iterator it = predetermined_variables.begin();
+           it != predetermined_variables.end(); it++)
+        output << "                   DynareModel.PredVars("
+               << getTypeSpecificID(*it)+1 << ")" << endl;
+      output << "                  ]" << endl;
+    }
 
-    if (observedVariablesNbr() > 0)
-      {
-        output << "# Observed Variables" << endl
-               << "options_.obs_vars = [" << endl;
-        for (vector<int>::const_iterator it = varobs.begin();
-             it != varobs.end(); it++)
-          output << "                    DynareModel.ObsVars("
-                 << getTypeSpecificID(*it)+1 << ")" << endl;
-        output << "                   ]" << endl;
-      }
+  if (observedVariablesNbr() > 0)
+    {
+      output << "# Observed Variables" << endl
+             << "options_.obs_vars = [" << endl;
+      for (vector<int>::const_iterator it = varobs.begin();
+           it != varobs.end(); it++)
+        output << "                    DynareModel.ObsVars("
+               << getTypeSpecificID(*it)+1 << ")" << endl;
+      output << "                   ]" << endl;
+    }
 }
diff --git a/SymbolTable.hh b/SymbolTable.hh
index 6d55e2f45c590f47bfece55dae6dbb6237663b58..d0e178ecc12c120fd5e6dfcc465125d04a41a632 100644
--- a/SymbolTable.hh
+++ b/SymbolTable.hh
@@ -59,13 +59,41 @@ private:
   expr_t expr_node; //! Auxiliary variable definition
 public:
   AuxVarInfo(int symb_id_arg, aux_var_t type_arg, int orig_symb_id, int orig_lead_lag, int equation_number_for_multiplier_arg, int information_set_arg, expr_t expr_node_arg);
-  int get_symb_id() const { return symb_id; };
-  aux_var_t get_type() const { return type; };
-  int get_orig_symb_id() const { return orig_symb_id; };
-  int get_orig_lead_lag() const { return orig_lead_lag; };
-  int get_equation_number_for_multiplier() const { return equation_number_for_multiplier; };
-  int get_information_set() const { return information_set; };
-  expr_t get_expr_node() const { return expr_node; } ;
+  int
+  get_symb_id() const
+  {
+    return symb_id;
+  };
+  aux_var_t
+  get_type() const
+  {
+    return type;
+  };
+  int
+  get_orig_symb_id() const
+  {
+    return orig_symb_id;
+  };
+  int
+  get_orig_lead_lag() const
+  {
+    return orig_lead_lag;
+  };
+  int
+  get_equation_number_for_multiplier() const
+  {
+    return equation_number_for_multiplier;
+  };
+  int
+  get_information_set() const
+  {
+    return information_set;
+  };
+  expr_t
+  get_expr_node() const
+  {
+    return expr_node;
+  };
 };
 
 //! Stores the symbol table
@@ -256,7 +284,11 @@ public:
   //! than the largest lag present in the model.
   int addVarModelEndoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, expr_t expr_arg) throw (AlreadyDeclaredException, FrozenException);
   //! Returns the number of auxiliary variables
-  int AuxVarsSize() const { return aux_vars.size(); };
+  int
+  AuxVarsSize() const
+  {
+    return aux_vars.size();
+  };
   //! Retruns expr_node for an auxiliary variable
   expr_t getAuxiliaryVarsExprNode(int symb_id) const throw (SearchFailedException);
   //! Tests if symbol already exists
diff --git a/WarningConsolidation.cc b/WarningConsolidation.cc
index 653d473053b469ae74a08a057512db2a65a8c9fe..f026dea8f3bf7375b93b2a0878a0cc6558c665b3 100644
--- a/WarningConsolidation.cc
+++ b/WarningConsolidation.cc
@@ -20,8 +20,9 @@
 #include "WarningConsolidation.hh"
 #include <ostream>
 
-WarningConsolidation&
-operator<< (WarningConsolidation& wcc, const string &warning)
+WarningConsolidation
+&
+operator<<(WarningConsolidation &wcc, const string &warning)
 {
   if (wcc.no_warn)
     return wcc;
@@ -31,8 +32,8 @@ operator<< (WarningConsolidation& wcc, const string &warning)
   return wcc;
 };
 
-WarningConsolidation&
-operator<< (WarningConsolidation& wcc, const Dynare::location& loc)
+WarningConsolidation &
+operator<<(WarningConsolidation &wcc, const Dynare::location &loc)
 {
   if (wcc.no_warn)
     return wcc;
@@ -54,8 +55,8 @@ operator<< (WarningConsolidation& wcc, const Dynare::location& loc)
   return wcc;
 };
 
-WarningConsolidation&
-operator<< (WarningConsolidation& wcc, ostream& (*pf) (ostream&))
+WarningConsolidation &
+operator<<(WarningConsolidation &wcc, ostream & (*pf)(ostream &))
 {
   if (wcc.no_warn)
     return wcc;
diff --git a/WarningConsolidation.hh b/WarningConsolidation.hh
index 135a54a39d6b6fdcb518a339cb039a19ceb8b0be..582af0f43fea7b9c8c890d7bdac1aa955cd39d66 100644
--- a/WarningConsolidation.hh
+++ b/WarningConsolidation.hh
@@ -34,16 +34,28 @@ private:
   bool no_warn;
 
 public:
-  WarningConsolidation(bool no_warn_arg) : no_warn(no_warn_arg) { };
-  ~WarningConsolidation() { };
+  WarningConsolidation(bool no_warn_arg) : no_warn(no_warn_arg)
+  {
+  };
+  ~WarningConsolidation()
+  {
+  };
 
   //! Add A Warning to the StringStream
-  friend WarningConsolidation& operator<< (WarningConsolidation& wcc, const string &warning);
-  friend WarningConsolidation& operator<< (WarningConsolidation& wcc, const Dynare::location &loc);
-  friend WarningConsolidation& operator<< (WarningConsolidation& wcc, ostream& (*pf) (ostream&));
+  friend WarningConsolidation &operator<<(WarningConsolidation &wcc, const string &warning);
+  friend WarningConsolidation &operator<<(WarningConsolidation &wcc, const Dynare::location &loc);
+  friend WarningConsolidation &operator<<(WarningConsolidation &wcc, ostream & (*pf)(ostream &));
 
-  inline void addWarning(const string &w) { warnings << w; };
-  inline void addWarning(ostream& (*pf) (ostream&)) { warnings << pf; };
+  inline void
+  addWarning(const string &w)
+  {
+    warnings << w;
+  };
+  inline void
+  addWarning(ostream & (*pf)(ostream &))
+  {
+    warnings << pf;
+  };
 
   //! Write Warnings to m file
   void writeOutput(ostream &output) const;
diff --git a/macro/MacroDriver.cc b/macro/MacroDriver.cc
index 1d13c5cee984fde412b12a3f6c5198044c8cad0c..c5193cc6bb2d18f5d9421d5e9c304f1c8572accb 100644
--- a/macro/MacroDriver.cc
+++ b/macro/MacroDriver.cc
@@ -55,14 +55,14 @@ MacroDriver::parse(const string &f, ostream &out, bool debug, bool no_line_macro
     an @#endif or an @#endfor - but no newline - no longer trigger an error.
   */
   stringstream file_with_endl;
-  for (map<string,string>::iterator it=defines.begin();
-       it!=defines.end(); it++)
+  for (map<string, string>::iterator it = defines.begin();
+       it != defines.end(); it++)
     try
       {
         boost::lexical_cast<int>(it->second);
         file_with_endl << "@#define " << it->first << " = " << it->second << endl;
       }
-    catch(boost::bad_lexical_cast &)
+    catch (boost::bad_lexical_cast &)
       {
         file_with_endl << "@#define " << it->first << " = \"" << it->second << "\"" << endl;
       }
diff --git a/macro/MacroDriver.hh b/macro/MacroDriver.hh
index 83828b2edc25f76ec95b341bb8e727bc08cd73ff..7b828b0286d8383cfbda5d7cc5ef700a21656d80 100644
--- a/macro/MacroDriver.hh
+++ b/macro/MacroDriver.hh
@@ -177,12 +177,13 @@ public:
   //! Constructor
   MacroDriver();
   //! Destructor
-  virtual ~MacroDriver();
+  virtual
+  ~MacroDriver();
 
   //! Starts parsing a file, returns output in out
   /*! \param no_line_macro should we omit the @#line statements ? */
   void parse(const string &f, ostream &out, bool debug, bool no_line_macro,
-             map<string,string> defines, vector<string> path);
+             map<string, string> defines, vector<string> path);
 
   //! Name of main file being parsed
   string file;
diff --git a/macro/MacroValue.hh b/macro/MacroValue.hh
index c9da9c3ddf2697e7b2be026968692e464b6b2429..64f0cdef73a6310f50642606ebdc6376f78f33e3 100644
--- a/macro/MacroValue.hh
+++ b/macro/MacroValue.hh
@@ -49,7 +49,8 @@ public:
   {
   };
   MacroValue(MacroDriver &driver_arg);
-  virtual ~MacroValue();
+  virtual
+  ~MacroValue();
   //! Applies + operator
   virtual const MacroValue *operator+(const MacroValue &mv) const throw (TypeError) = 0;
   //! Applies unary + operator
@@ -118,7 +119,8 @@ private:
   const int value;
 public:
   IntMV(MacroDriver &driver, int value_arg);
-  virtual ~IntMV();
+  virtual
+  ~IntMV();
   //! Computes arithmetic addition
   virtual const MacroValue *operator+(const MacroValue &mv) const throw (TypeError);
   //! Unary plus
@@ -158,7 +160,11 @@ public:
     If mv2 < mv1, returns an empty range (for consistency with MATLAB).
   */
   static const MacroValue *new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *mv2) throw (TypeError);
-  inline int get_int_value() const { return value; };
+  inline int
+  get_int_value() const
+  {
+    return value;
+  };
 };
 
 //! Represents a string value in macro language
@@ -170,7 +176,8 @@ private:
   const string value;
 public:
   StringMV(MacroDriver &driver, const string &value_arg);
-  virtual ~StringMV();
+  virtual
+  ~StringMV();
   //! Computes string concatenation
   virtual const MacroValue *operator+(const MacroValue &mv) const throw (TypeError);
   virtual const MacroValue *operator==(const MacroValue &mv) const throw (TypeError);
@@ -202,7 +209,8 @@ private:
   const vector<T> values;
 public:
   ArrayMV(MacroDriver &driver, const vector<T> &values_arg);
-  virtual ~ArrayMV();
+  virtual
+  ~ArrayMV();
   //! Computes array concatenation
   /*! Both array must be of same type */
   virtual const MacroValue *operator+(const MacroValue &mv) const throw (TypeError);