diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index b04be55826144cb9175fe0453e38b14bdea7d256..2092b5db68f27b501ad70f4e84060fbc3cb47f7b 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -3813,21 +3813,6 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
     }
 }
 
-map<tuple<int, int, int>, expr_t>
-DynamicModel::collect_first_order_derivatives_endogenous()
-{
-  map<tuple<int, int, int>, expr_t> endo_derivatives;
-  for (auto & [indices, d1] : derivatives[1])
-    if (getTypeByDerivID(indices[1]) == SymbolType::endogenous)
-      {
-        int eq = indices[0];
-        int var = symbol_table.getTypeSpecificID(getSymbIDByDerivID(indices[1]));
-        int lag = getLagByDerivID(indices[1]);
-        endo_derivatives[{ eq, var, lag }] = d1;
-      }
-  return endo_derivatives;
-}
-
 void
 DynamicModel::runTrendTest(const eval_context_t &eval_context)
 {
@@ -4816,7 +4801,7 @@ DynamicModel::computingPass(bool jacobianExo, int derivsOrder, int paramsDerivsO
 
   if (linear_decomposition)
     {
-      first_order_endo_derivatives = collect_first_order_derivatives_endogenous();
+      first_order_endo_derivatives = collectFirstOrderDerivativesEndogenous();
       is_equation_linear = equationLinear(first_order_endo_derivatives);
 
       tie(contemporaneous_jacobian, static_jacobian) = evaluateAndReduceJacobian(eval_context, cutoff, false);
@@ -4856,7 +4841,7 @@ DynamicModel::computingPass(bool jacobianExo, int derivsOrder, int paramsDerivsO
 
       computePrologueAndEpilogue(static_jacobian);
 
-      first_order_endo_derivatives = collect_first_order_derivatives_endogenous();
+      first_order_endo_derivatives = collectFirstOrderDerivativesEndogenous();
 
       equationTypeDetermination(first_order_endo_derivatives, mfs);
 
diff --git a/src/DynamicModel.hh b/src/DynamicModel.hh
index b834310dfd93a67a382b89ca8cae463eb51f1127..6e8efb6bbcfa67acd549485ea60be83a78d76215 100644
--- a/src/DynamicModel.hh
+++ b/src/DynamicModel.hh
@@ -162,8 +162,6 @@ private:
   void computeDynJacobianCols(bool jacobianExo);
   //! Computes derivatives of the Jacobian w.r. to trend vars and tests that they are equal to zero
   void testTrendDerivativesEqualToZero(const eval_context_t &eval_context);
-  //! Collect only the first derivatives
-  map<tuple<int, int, int>, expr_t> collect_first_order_derivatives_endogenous();
 
   //! Allocates the derivation IDs for all dynamic variables of the model
   /*! Also computes max_{endo,exo}_{lead_lag}, and initializes dynJacobianColsNbr to the number of dynamic endos */
diff --git a/src/ModelTree.cc b/src/ModelTree.cc
index e39f190a0b452564454c120e3a1a4bc2b2794fff..266e965a7e05fbfee3a6eff1c8a7a18979fe1103 100644
--- a/src/ModelTree.cc
+++ b/src/ModelTree.cc
@@ -2413,3 +2413,18 @@ ModelTree::reorderAuxiliaryEquations()
   for (int i = 0; i < n; i++)
     aux_equations[i] = aux_equations_old[index[ordered[i]]];
 }
+
+map<tuple<int, int, int>, expr_t>
+ModelTree::collectFirstOrderDerivativesEndogenous()
+{
+  map<tuple<int, int, int>, expr_t> endo_derivatives;
+  for (auto &[indices, d1] : derivatives[1])
+    if (getTypeByDerivID(indices[1]) == SymbolType::endogenous)
+      {
+        int eq = indices[0];
+        int var = symbol_table.getTypeSpecificID(getSymbIDByDerivID(indices[1]));
+        int lag = getLagByDerivID(indices[1]);
+        endo_derivatives[{ eq, var, lag }] = d1;
+      }
+  return endo_derivatives;
+}
diff --git a/src/ModelTree.hh b/src/ModelTree.hh
index 8ae42108f671f13a9d3837464bab00c5d2f4e0fe..734069a265a54d3ff78545560f0394166e7741f5 100644
--- a/src/ModelTree.hh
+++ b/src/ModelTree.hh
@@ -365,6 +365,10 @@ protected:
   virtual int getBlockInitialOtherEndogenousID(int block_number, int variable_number) const = 0;
   //! Initialize equation_reordered & variable_reordered
   void initializeVariablesAndEquations();
+  //! Returns the 1st derivatives w.r.t. endogenous in a different format
+  /*! Returns a map (equation, type-specific ID, lag) → derivative.
+      Assumes that derivatives have already been computed. */
+  map<tuple<int, int, int>, expr_t> collectFirstOrderDerivativesEndogenous();
 
 private:
   //! Internal helper for the copy constructor and assignment operator
diff --git a/src/StaticModel.cc b/src/StaticModel.cc
index c8f477738b1049fbaf3765135b53547951ad41c8..45ee4c5db2c60aacb302946b33842780349b8129 100644
--- a/src/StaticModel.cc
+++ b/src/StaticModel.cc
@@ -1087,23 +1087,6 @@ StaticModel::Write_Inf_To_Bin_File_Block(const string &basename, int num,
   SaveCode.close();
 }
 
-map<tuple<int, int, int>, expr_t>
-StaticModel::collect_first_order_derivatives_endogenous()
-{
-  map<tuple<int, int, int>, expr_t> endo_derivatives;
-  for (auto & [indices, d1] : derivatives[1])
-    {
-      if (getTypeByDerivID(indices[1]) == SymbolType::endogenous)
-        {
-          int eq = indices[0];
-          int var = symbol_table.getTypeSpecificID(getSymbIDByDerivID(indices[1]));
-          int lag = 0;
-          endo_derivatives[{ eq, var, lag }] = d1;
-        }
-    }
-  return endo_derivatives;
-}
-
 void
 StaticModel::computingPass(int derivsOrder, int paramsDerivsOrder, const eval_context_t &eval_context, bool no_tmp_terms, bool block, bool bytecode)
 {
@@ -1153,7 +1136,7 @@ StaticModel::computingPass(int derivsOrder, int paramsDerivsOrder, const eval_co
 
       computePrologueAndEpilogue(static_jacobian);
 
-      auto first_order_endo_derivatives = collect_first_order_derivatives_endogenous();
+      auto first_order_endo_derivatives = collectFirstOrderDerivativesEndogenous();
 
       equationTypeDetermination(first_order_endo_derivatives, mfs);
 
diff --git a/src/StaticModel.hh b/src/StaticModel.hh
index d44febc477d8de12e4230bc90eff7c51276bc6cf..6fd760e97ee4744c0420c0e5d406511cdb22d610 100644
--- a/src/StaticModel.hh
+++ b/src/StaticModel.hh
@@ -91,8 +91,6 @@ private:
   map<tuple<int, int, int, int, int>, int> get_Derivatives(int block);
   //! Computes chain rule derivatives of the Jacobian w.r. to endogenous variables
   void computeChainRuleJacobian();
-  //! Collect only the first derivatives
-  map<tuple<int, int, int>, expr_t> collect_first_order_derivatives_endogenous();
 
   //! Collecte the derivatives w.r. to endogenous of the block, to endogenous of previouys blocks and to exogenous
   void collect_block_first_order_derivatives();