diff --git a/preprocessor/BlockTriangular.cc b/preprocessor/BlockTriangular.cc
index 557f0b42c8b5cbf96dbec4e1d48aab7292edebda..65813d5bd68347d13207ce99e86a63bca30a9bdf 100644
--- a/preprocessor/BlockTriangular.cc
+++ b/preprocessor/BlockTriangular.cc
@@ -290,7 +290,7 @@ BlockTriangular::Compute_Block_Decomposition_and_Feedback_Variables_For_Each_Blo
       components_set[i].second.first = feed_back_vertices;
       blocks[i].second = feed_back_vertices.size();
       vector<int> Reordered_Vertice;
-      Reordered_Vertice = Reorder_the_recursive_variables(G, feed_back_vertices);
+      Reorder_the_recursive_variables(G, feed_back_vertices, Reordered_Vertice);
       //First we have the recursive equations conditional on feedback variables
       for (vector<int>::iterator its = Reordered_Vertice.begin(); its != Reordered_Vertice.end(); its++)
         {
diff --git a/preprocessor/DynamicModel.cc b/preprocessor/DynamicModel.cc
index 75b7ce9e50ac9005f374e96d9f3e57bcf5a1d18e..0ce1534b23de2851cf79e14d9d3affdb763b240c 100644
--- a/preprocessor/DynamicModel.cc
+++ b/preprocessor/DynamicModel.cc
@@ -2928,6 +2928,19 @@ DynamicModel::writeParamsDerivativesFile(const string &basename) const
     paramsDerivsFile.close();
   }
 
+void
+DynamicModel::writeChaineRuleDerivative(ostream &output, int eq, int var, int lag,
+                           ExprNodeOutputType output_type,
+                           const temporary_terms_type &temporary_terms) const
+{
+  map<pair<int, pair<int, int> >, NodeID>::const_iterator it = first_chaine_rule_derivatives.find(make_pair(eq, make_pair(var, lag)));
+  if (it != first_chaine_rule_derivatives.end())
+    (it->second)->writeOutput(output, output_type, temporary_terms);
+  else
+    output << 0;
+}
+
+
 void
 DynamicModel::writeLatexFile(const string &basename) const
   {
@@ -2955,3 +2968,5 @@ DynamicModel::hessianHelper(ostream &output, int row_nb, int col_nb, ExprNodeOut
     output << row_nb + col_nb * NNZDerivatives[1];
   output << RIGHT_ARRAY_SUBSCRIPT(output_type);
 }
+
+
diff --git a/preprocessor/DynamicModel.hh b/preprocessor/DynamicModel.hh
index 7ecefae5a2793f20a77715a3ed5675cdc377a6c9..a93244141de143309649a651977a7d61b76860c1 100644
--- a/preprocessor/DynamicModel.hh
+++ b/preprocessor/DynamicModel.hh
@@ -77,6 +77,10 @@ private:
   //! Temporary terms for the file containing parameters dervicatives
   temporary_terms_type params_derivs_temporary_terms;
 
+  typedef map< pair< int, pair< int, int> >, NodeID> first_chaine_rule_derivatives_type;
+  first_chaine_rule_derivatives_type first_chaine_rule_derivatives;
+
+
   //! Writes dynamic model file (Matlab version)
   void writeDynamicMFile(const string &dynamic_basename) const;
   //! Writes dynamic model file (C version)
@@ -133,6 +137,10 @@ private:
   /*! Writes either (i+1,j+1) or [i+j*NNZDerivatives[1]] */
   void hessianHelper(ostream &output, int row_nb, int col_nb, ExprNodeOutputType output_type) const;
 
+  //! Write chaine rule derivative of a recursive equation w.r. to a variable
+  void writeChaineRuleDerivative(ostream &output, int eq, int var, int lag, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms) const;
+
+
 public:
   DynamicModel(SymbolTable &symbol_table_arg, NumericalConstants &num_constants);
   //! Mode in which the ModelTree is supposed to work (Matlab, DLL or SparseDLL)
diff --git a/preprocessor/MinimumFeedbackSet.cc b/preprocessor/MinimumFeedbackSet.cc
index d39f89daceeadbd5312e61026cefe1c1b94cd777..0be2e17a9bcf0fab4994203aef3e1cc92d41a1d8 100644
--- a/preprocessor/MinimumFeedbackSet.cc
+++ b/preprocessor/MinimumFeedbackSet.cc
@@ -26,8 +26,6 @@ namespace MFS
     void
     Suppress(AdjacencyList_type::vertex_descriptor vertex_to_eliminate, AdjacencyList_type& G)
     {
-    	/*clear all in and out edges of vertex_to_eliminate
-      and remove vertex_to_eliminate from the graph*/
       clear_vertex(vertex_to_eliminate, G);
       remove_vertex(vertex_to_eliminate, G);
     }
@@ -43,7 +41,6 @@ namespace MFS
     void
     Eliminate(AdjacencyList_type::vertex_descriptor vertex_to_eliminate, AdjacencyList_type& G)
     {
-    	/*before the vertex i suppression replace all edges e_k_i and e_i_j by e_k_j*/
       if (in_degree (vertex_to_eliminate, G) > 0 && out_degree (vertex_to_eliminate, G) > 0)
         {
           AdjacencyList_type::in_edge_iterator it_in, in_end;
@@ -69,14 +66,11 @@ namespace MFS
       color[u] = gray_color;
       graph_traits<AdjacencyList_type>::out_edge_iterator vi, vi_end;
       for (tie(vi, vi_end) = out_edges(u, g); vi != vi_end; ++vi)
-        if (color[target(*vi, g)] == white_color)
+        if (color[target(*vi, g)] == white_color && has_cycle_dfs(g, target(*vi, g), color, circuit_stack))
           {
-          	if (has_cycle_dfs(g, target(*vi, g), color, circuit_stack))
-          	  {
-                // cycle detected, return immediately
-                circuit_stack.push_back(v_index[target(*vi, g)]);
-                return true;
-          	  }
+            // cycle detected, return immediately
+            circuit_stack.push_back(v_index[target(*vi, g)]);
+            return true;
           }
         else if (color[target(*vi, g)] == gray_color)
           {
@@ -215,8 +209,6 @@ namespace MFS
     vector_vertex_descriptor
     Collect_Doublet(AdjacencyList_type::vertex_descriptor vertex, AdjacencyList_type& G)
     {
-    	/*collect all doublet (for each edge e_i_k there is an edge e_k_i with k!=i) in the graph
-        and return the vector of doublet*/
       AdjacencyList_type::in_edge_iterator it_in, in_end;
       AdjacencyList_type::out_edge_iterator it_out, out_end;
       vector<AdjacencyList_type::vertex_descriptor> Doublet;
@@ -231,7 +223,6 @@ namespace MFS
     bool
     Vertex_Belong_to_a_Clique(AdjacencyList_type::vertex_descriptor vertex, AdjacencyList_type& G)
     {
-    	/*Detect all the clique (all vertex in a clique are related to each other) in the graph*/
       vector<AdjacencyList_type::vertex_descriptor> liste;
       bool agree = true;
       AdjacencyList_type::in_edge_iterator it_in, in_end;
@@ -271,7 +262,6 @@ namespace MFS
     bool
     Elimination_of_Vertex_With_One_or_Less_Indegree_or_Outdegree_Step(AdjacencyList_type& G)
     {
-    	/*Graph reduction: eliminating purely intermediate variables or variables outside of any circuit*/
       bool something_has_been_done = false;
       bool not_a_loop;
       int i;
@@ -466,8 +456,8 @@ namespace MFS
           }
       };
 
-    vector<int>
-    Reorder_the_recursive_variables(const AdjacencyList_type& G1, set<int> &feedback_vertices)
+    void
+    Reorder_the_recursive_variables(const AdjacencyList_type& G1, set<int> &feedback_vertices, vector< int> &Reordered_Vertices)
     {
       AdjacencyList_type G(G1);
       property_map<AdjacencyList_type, vertex_index_t>::type v_index = get(vertex_index, G);
@@ -477,11 +467,7 @@ namespace MFS
         fv.insert(*its);
       int i=0;
       for (its = fv.begin(); its != fv.end(); ++its, i++)
-        {
-          //cout << "supress " << v_index[vertex(*its, G)]+1 << "  " << *its << "\n";
-          Suppress(*its, G);
-        }
-      vector< int> Reordered_Vertices;
+				Suppress(*its, G);
       bool something_has_been_done = true;
       while (something_has_been_done)
         {
@@ -507,6 +493,5 @@ namespace MFS
         }
       if (num_vertices(G))
         cout << "Error in the computation of feedback vertex set\n";
-      return Reordered_Vertices;
     }
   }
diff --git a/preprocessor/MinimumFeedbackSet.hh b/preprocessor/MinimumFeedbackSet.hh
index 95ba6cbb7848e2c39c5bc08ef8dc79052df9886a..bac12b38edc3e21bdcca9c1d2b5f49d6a4302882 100644
--- a/preprocessor/MinimumFeedbackSet.hh
+++ b/preprocessor/MinimumFeedbackSet.hh
@@ -73,7 +73,7 @@ namespace MFS
   void Suppress(int vertex_num, AdjacencyList_type& G);
   //! Reorder the recursive variables
   /*! They appear first in a quasi triangular form and they are followed by the feedback variables */
-  vector<int> Reorder_the_recursive_variables(const AdjacencyList_type& G1, set<int> &feed_back_vertices);
+	void Reorder_the_recursive_variables(const AdjacencyList_type& G1, set<int> &feedback_vertices, vector< int> &Reordered_Vertices);
 };
 
 #endif // _MINIMUMFEEDBACKSET_HH
diff --git a/preprocessor/ModelTree.cc b/preprocessor/ModelTree.cc
index c590e68ef86a9138d0de3e01eabe07ac5c4b780c..e7dd0e8af5465ecd6822dd92fccb0b0c569a26fc 100644
--- a/preprocessor/ModelTree.cc
+++ b/preprocessor/ModelTree.cc
@@ -65,18 +65,6 @@ ModelTree::computeJacobian(const set<int> &vars)
       }
 }
 
-void
-ModelTree::writeChaineRuleDerivative(ostream &output, int eq, int var, int lag,
-                           ExprNodeOutputType output_type,
-                           const temporary_terms_type &temporary_terms) const
-{
-  map<pair<int, pair<int, int> >, NodeID>::const_iterator it = first_chaine_rule_derivatives.find(make_pair(eq, make_pair(var, lag)));
-  if (it != first_chaine_rule_derivatives.end())
-    (it->second)->writeOutput(output, output_type, temporary_terms);
-  else
-    output << 0;
-}
-
 
 
 void
diff --git a/preprocessor/ModelTree.hh b/preprocessor/ModelTree.hh
index 7037778c7aaeb05925fe315c46a839ca5c96d4cc..4293104da8a85d668f471b0f21fe772787a43402 100644
--- a/preprocessor/ModelTree.hh
+++ b/preprocessor/ModelTree.hh
@@ -47,8 +47,6 @@ protected:
   */
   first_derivatives_type first_derivatives;
 
-  typedef map< pair< int, pair< int, int> >, NodeID> first_chaine_rule_derivatives_type;
-  first_chaine_rule_derivatives_type first_chaine_rule_derivatives;
 
   typedef map<pair<int, pair<int, int> >, NodeID> second_derivatives_type;
   //! Second order derivatives
@@ -83,8 +81,6 @@ protected:
 
   //! Write derivative of an equation w.r. to a variable
   void writeDerivative(ostream &output, int eq, int symb_id, int lag, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms) const;
-  //! Write chaine rule derivative of a recursive equation w.r. to a variable
-  void writeChaineRuleDerivative(ostream &output, int eq, int var, int lag, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms) const;
   //! Computes temporary terms (for all equations and derivatives)
   void computeTemporaryTerms(bool is_matlab);
   //! Writes temporary terms