diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc
index 90964908c47c1b7b532fe79dbdbc2d308a4f8fc8..f278bf6c4d5d42355751a9dd98f0afdb628fbb76 100644
--- a/src/ComputingTasks.cc
+++ b/src/ComputingTasks.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2003-2023 Dynare Team
+ * Copyright © 2003-2024 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -2439,14 +2439,7 @@ void
 PlannerObjectiveStatement::writeOutput(ostream& output, const string& basename,
                                        [[maybe_unused]] bool minimal_workspace) const
 {
-  output << "M_.NNZDerivatives_objective = [";
-  for (int i = 1; i < static_cast<int>(model_tree->getNNZDerivatives().size()); i++)
-    output << (i > model_tree->getComputedDerivsOrder() ? -1 : model_tree->getNNZDerivatives()[i])
-           << ";";
-  output << "];" << endl << "M_.objective_tmp_nbr = [";
-  for (const auto& temporary_terms_derivative : model_tree->getTemporaryTermsDerivatives())
-    output << temporary_terms_derivative.size() << "; ";
-  output << "];" << endl;
+  model_tree->writeDriverOutput(output);
   model_tree->writeStaticFile(basename + ".objective", false, "", {}, false);
 }
 
diff --git a/src/ModelEquationBlock.cc b/src/ModelEquationBlock.cc
index 212e01947f30c70c6aca06811c0a9ef410004013..6667992b4300e13479ca666351b81cb8a16980f4 100644
--- a/src/ModelEquationBlock.cc
+++ b/src/ModelEquationBlock.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2010-2023 Dynare Team
+ * Copyright © 2010-2024 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -31,6 +31,18 @@ PlannerObjective::PlannerObjective(SymbolTable& symbol_table_arg,
 {
 }
 
+void
+PlannerObjective::writeDriverOutput(ostream& output) const
+{
+  output << "M_.NNZDerivatives_objective = [";
+  for (int i = 1; i < static_cast<int>(NNZDerivatives.size()); i++)
+    output << (i > computed_derivs_order ? -1 : NNZDerivatives[i]) << ";";
+  output << "];" << endl << "M_.objective_tmp_nbr = [";
+  for (const auto& it : temporary_terms_derivatives)
+    output << it.size() << "; ";
+  output << "];" << endl;
+}
+
 void
 PlannerObjective::computingPassBlock([[maybe_unused]] const eval_context_t& eval_context,
                                      [[maybe_unused]] bool no_tmp_terms)
diff --git a/src/ModelEquationBlock.hh b/src/ModelEquationBlock.hh
index aedf9e61ce9980339509bcdc8ced7859ee89d903..cd6844b10cfce30fd3e62f2bb6f20b318f7d63a7 100644
--- a/src/ModelEquationBlock.hh
+++ b/src/ModelEquationBlock.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2010-2023 Dynare Team
+ * Copyright © 2010-2024 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -31,6 +31,8 @@ class PlannerObjective : public StaticModel
 public:
   PlannerObjective(SymbolTable& symbol_table_arg, NumericalConstants& num_constants_arg,
                    ExternalFunctionsTable& external_functions_table_arg);
+  // NB: masks the method with the same name in StaticModel (not in a virtual fashion)
+  void writeDriverOutput(ostream& output) const;
 
 protected:
   string
diff --git a/src/ModelTree.hh b/src/ModelTree.hh
index 8d068593e996ba48ccc1ecc84885c0c78e01e823..d3f87199f069b79f191833803b9d0e35d4640ed1 100644
--- a/src/ModelTree.hh
+++ b/src/ModelTree.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2003-2023 Dynare Team
+ * Copyright © 2003-2024 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -689,27 +689,6 @@ public:
   // Write the definitions of the auxiliary variables (assumed to be in recursive order)
   void writeAuxVarRecursiveDefinitions(ostream& output, ExprNodeOutputType output_type) const;
 
-  //! Returns the vector of non-zero derivative counts
-  const vector<int>&
-  getNNZDerivatives() const
-  {
-    return NNZDerivatives;
-  }
-
-  //! Returns the vector of temporary terms derivatives
-  const vector<temporary_terms_t>&
-  getTemporaryTermsDerivatives() const
-  {
-    return temporary_terms_derivatives;
-  }
-
-  //! Returns the maximum order of computed derivatives
-  int
-  getComputedDerivsOrder() const
-  {
-    return computed_derivs_order;
-  }
-
   static string
   BlockSim(BlockSimulationType type)
   {