diff --git a/preprocessor/DynamicModel.cc b/preprocessor/DynamicModel.cc
index e6c058bd1c7e571c34d804c2e13dea8f2f1de280..336f2cd404fcdd1943b3773d974516c51cba0546 100644
--- a/preprocessor/DynamicModel.cc
+++ b/preprocessor/DynamicModel.cc
@@ -1575,7 +1575,11 @@ DynamicModel::writeDynamicJuliaFile(const string &basename) const
       exit(EXIT_FAILURE);
     }
 
-  output << "module " << basename << "Dynamic" << endl << endl
+  output << "module " << basename << "Dynamic" << endl
+         << "#" << endl
+         << "# NB: this file was automatically generated by Dynare" << endl
+         << "#     from " << basename << ".mod" << endl
+         << "#" << endl
          << "using Utils" << endl << endl
          << "export dynamic!" << endl << endl;
   writeDynamicModel(output, false, true);
@@ -2365,16 +2369,29 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia
     }
   else
     {
+      ostringstream comments;
+      comments << "## Function Arguments" << endl
+               << endl
+               << "## Input" << endl
+               << " 1 y:            Array{Float64, num_dynamic_vars, 1}             Vector of endogenous variables in the order stored" << endl
+               << "                                                                 in model.lead_lag_incidence; see the manual" << endl
+               << " 2 x:            Array{Float64, nperiods, length(model.exo)}     Matrix of exogenous variables (in declaration order)" << endl
+               << "                                                                 for all simulation periods" << endl
+               << " 3 params:       Array{Float64, length(model.param), 1}          Vector of parameter values in declaration order" << endl
+               << " 4 steady_state:" << endl
+               << " 5 it_:          Int                                             Time period for exogenous variables for which to evaluate the model" << endl
+               << endl
+               << "## Output" << endl
+               << " 6 residual:     Array(Float64, model.eq_nbr, 1)                 Vector of residuals of the dynamic model equations in" << endl
+               << "                                                                 order of declaration of the equations." << endl;
+
       DynamicOutput << "function dynamic!(y::Vector{Float64}, x::Matrix{Float64}, "
                     << "params::Vector{Float64}," << endl
                     << "                  steady_state::Vector{Float64}, it_::Int, "
                     << "residual::Vector{Float64})" << endl
-                    << "#" << endl
-                    << "# Function argument sizes:" << endl
-                    << "# residual: Array(Float64, model.eq_nbr, 1)" << endl
-                    << "#" << endl
+                    << "#=" << endl << comments.str() << "=#" << endl
                     << "@assert size(residual) == " << nrows << endl
-                    << "fill!(residual, 0.0)" << endl << endl
+                    << "fill!(residual, 0.0)" << endl
                     << "#" << endl
                     << "# Model equations" << endl
                     << "#" << endl
@@ -2385,14 +2402,15 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia
                     << "params::Vector{Float64}," << endl
                     << "                  steady_state::Vector{Float64}, it_::Int, "
                     << "residual::Vector{Float64}," << endl
-                    << "                  g1::Matrix{Float64})" << endl
-                    << "  #" << endl
-                    << "  # Function argument sizes:" << endl
-                    << "  # residual: Array(Float64, model.eq_nbr, 1)" << endl
-                    << "  # g1: Array(Float64, model.eq_nbr, num_dynamic_endo_(+exo?)_vars)" << endl
-                    << "  #" << endl
+                    << "                  g1::Matrix{Float64})" << endl;
+
+      comments << " 7 g1:           Array(Float64, model.eq_nbr, num_dynamic_vars)  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" << endl;
+
+      DynamicOutput << "#=" << endl << comments.str() << "=#" << endl
                     << "  @assert size(g1) == (" << nrows << ", " << dynJacobianColsNbr << ")" << endl
-                    << "  fill!(g1, 0.0)" << endl << endl
+                    << "  fill!(g1, 0.0)" << endl
                     << "  dynamic!(y, x, params, steady_state, it_, residual)" << endl
                     << model_output.str()
                     << "  #" << endl
@@ -2404,13 +2422,13 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia
                     << "params::Vector{Float64}," << endl
                     << "                  steady_state::Vector{Float64}, it_::Int, "
                     << "residual::Vector{Float64}," << endl
-                    << "                  g1::Matrix{Float64}, g2::Matrix{Float64})" << endl
-                    << "  #" << endl
-                    << "  # Function argument sizes:" << endl
-                    << "  # residual: Array(Float64, model.eq_nbr, 1)" << endl
-                    << "  # g1: Array(Float64, model.eq_nbr, num_dynamic_endo_(+exo?)_vars)" << endl
-                    << "  # g2: spzeros(model.eq_nbr, (num_dynamic_endo_(+exo?)_vars)^2)" << endl
-                    << "  #" << endl << endl
+                    << "                  g1::Matrix{Float64}, g2::Matrix{Float64})" << endl;
+
+      comments << " 8 g2:           spzeros(model.eq_nbr, (num_dynamic_vars)^2)     Hessian matrix of the dynamic model equations;" << endl
+               << "                                                                 rows: equations in order of declaration" << endl
+               << "                                                                 columns: variables in order stored in M_.lead_lag_incidence" << endl;
+
+      DynamicOutput << "#=" << endl << comments.str() << "=#" << endl
                     << "  @assert size(g2) == (" << nrows << ", " << hessianColsNbr << ")" << endl
                     << "  dynamic!(y, x, params, steady_state, it_, residual, g1)" << endl;
       if (second_derivatives.size())
@@ -2427,14 +2445,13 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll, bool julia
                     << "params::Vector{Float64}," << endl
                     << "                  steady_state::Vector{Float64}, it_::Int, "
                     << "residual::Vector{Float64}," << endl
-                    << "                  g1::Matrix{Float64}, g2::Matrix{Float64}, g3::Matrix{Float64})" << endl
-                    << "  #" << endl
-                    << "  # Function argument sizes:" << endl
-                    << "  # residual: Array(Float64, model.eq_nbr, 1)" << endl
-                    << "  # g1: Array(Float64, model.eq_nbr, num_dynamic_endo_(+exo?)_vars)" << endl
-                    << "  # g2: spzeros(model.eq_nbr, (num_dynamic_endo_(+exo?)_vars)^2)" << endl
-                    << "  # g3: spzeros(model.eq_nbr, (num_dynamic_endo_(+exo?)_vars)^3)" << endl
-                    << "  #" << endl << endl
+                    << "                  g1::Matrix{Float64}, g2::Matrix{Float64}, g3::Matrix{Float64})" << endl;
+
+      comments << " 9 g3:           spzeros(model.eq_nbr, (num_dynamic_vars)^3)     Third order derivative matrix of the dynamic model equations;" << endl
+               << "                                                                 rows: equations in order of declaration" << endl
+               << "                                                                 columns: variables in order stored in M_.lead_lag_incidence" << endl;
+
+      DynamicOutput << "#=" << endl << comments.str() << "=#" << endl
                     << "  @assert size(g3) == (" << nrows << ", " << ncols << ")" << endl
                     << "  dynamic!(y, x, params, steady_state, it_, residual, g1, g2)" << endl;
       if (third_derivatives.size())
@@ -3934,7 +3951,11 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
                      << "% Warning : this file is generated automatically by Dynare" << endl
                      << "%           from model file (.mod)" << endl << endl;
   else
-    paramsDerivsFile << "module " << basename << "DynamicParamsDerivs" << endl << endl
+    paramsDerivsFile << "module " << basename << "DynamicParamsDerivs" << endl
+                     << "#" << endl
+                     << "# NB: this file was automatically generated by Dynare" << endl
+                     << "#     from " << basename << ".mod" << endl
+                     << "#" << endl
                      << "export params_derivs" << endl << endl
                      << "function params_derivs(y, x, paramssteady_state, it_, "
                      << "ss_param_deriv, ss_param_2nd_deriv)" << endl;
diff --git a/preprocessor/ModFile.cc b/preprocessor/ModFile.cc
index d86c9fdadf1c2da51a45e74ad61a55a5fbd05ca9..1ea53ad7ef8cdd035eee6fe0d0b77a00c27bdd99 100644
--- a/preprocessor/ModFile.cc
+++ b/preprocessor/ModFile.cc
@@ -1077,10 +1077,10 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output)
     }
 
   jlOutputFile << "module " << basename << endl
-               << "##" << endl
-               << " # Note : this file was automatically generated by Dynare" << endl
-               << " #        from " << basename << ".mod" << endl
-               << "##" << endl
+               << "#" << endl
+               << "# NB: this file was automatically generated by Dynare" << endl
+               << "#     from " << basename << ".mod" << endl
+               << "#" << endl
                << "using DynareModel" << endl
                << "using DynareOptions" << endl
                << "using DynareOutput" << endl
diff --git a/preprocessor/StaticModel.cc b/preprocessor/StaticModel.cc
index 14728ef7b128290321568206287220a5a0b0eb7b..1f5ef56e2b5c967232976ea73da8995ee6532112 100644
--- a/preprocessor/StaticModel.cc
+++ b/preprocessor/StaticModel.cc
@@ -1436,15 +1436,25 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
     }
   else
     {
+      ostringstream comments;
+      comments << "## Function Arguments" << endl
+               << endl
+               << "## Input" << endl
+               << " 1 y:         Array{Float64, length(model.endo), 1}             Vector of endogenous variables in declaration order" << endl
+               << " 2 x:         Array{Float64, length(model.exo), 1}              Vector of exogenous variables in declaration order" << endl
+               << " 3 params:    Array{Float64, length(model.param), 1}            Vector of parameter values in declaration order" << endl
+               << endl
+               << "## Output" << endl
+               << " 4 residual:  Array(Float64, model.eq_nbr, 1)                   Vector of residuals of the static model equations" << endl
+               << "                                                                in order of declaration of the equations." << endl
+               << "                                                                Dynare may prepend auxiliary equations, see model.aux_vars" << endl;
+
       StaticOutput << "function static!(y::Vector{Float64}, x::Vector{Float64}, "
                    << "params::Vector{Float64}," << endl
                    << "                 residual::Vector{Float64})" << endl
-                   << "#" << endl
-                   << "# Function argument sizes:" << endl
-                   << "# residual: Array(Float64, model.eq_nbr, 1)" << endl
-                   << "#" << endl
+                   << "#=" << endl << comments.str() << "=#" << endl
                    << "@assert size(residual) == " << equations.size() << endl
-                   << "fill!(residual, 0.0)" << endl << endl
+                   << "fill!(residual, 0.0)" << endl
                    << "#" << endl
                    << "# Model equations" << endl
                    << "#" << endl
@@ -1456,15 +1466,16 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
                    << "end" << endl << endl
                    << "function static!(y::Vector{Float64}, x::Vector{Float64}, "
                    << "params::Vector{Float64}," << endl
-                   << "                 residual::Vector{Float64}, g1::Matrix{Float64})" << endl
-                   << "  #" << endl
-                   << "  # Function argument sizes:" << endl
-                   << "  # residual: Array(Float64, model.eq_nbr, 1)" << endl
-                   << "  # g1: Array(Float64, model.eq_nbr, length(model.endo))" << endl
-                   << "  #" << endl
+                   << "                 residual::Vector{Float64}, g1::Matrix{Float64})" << endl;
+
+      comments << " 5 g1:        Array(Float64, model.eq_nbr, length(model.endo))  Jacobian matrix of the static model equations;" << endl
+               << "                                                                columns: variables in declaration order" << endl
+               << "                                                                rows: equations in order of declaration" << endl;
+
+      StaticOutput << "#=" << endl << comments.str() << "=#" << endl
                    << "  @assert size(g1) == (" << equations.size() << ", " << symbol_table.endo_nbr()
                    << ")" << endl
-                   << "  fill!(g1, 0.0)" << endl << endl
+                   << "  fill!(g1, 0.0)" << endl
                    << "  static!(y, x, params, residual)" << endl
                    << model_output.str()
                    << "  #" << endl
@@ -1478,13 +1489,13 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
                    << "function static!(y::Vector{Float64}, x::Vector{Float64}, "
                    << "params::Vector{Float64}," << endl
                    << "                 residual::Vector{Float64}, g1::Matrix{Float64}, "
-                   << "g2::Matrix{Float64})" << endl
-                   << "  #" << endl
-                   << "  # Function argument sizes:" << endl
-                   << "  # residual: Array(Float64, model.eq_nbr, 1)" << endl
-                   << "  # g1: Array(Float64, model.eq_nbr, length(model.endo))" << endl
-                   << "  # g2: spzeros(model.eq_nbr, length(model.endo)^2)" << endl
-                   << "  #" << endl << endl
+                   << "g2::Matrix{Float64})" << endl;
+
+      comments << " 6 g2:        spzeros(model.eq_nbr, length(model.endo)^2)       Hessian matrix of the static model equations;" << endl
+               << "                                                                columns: variables in declaration order" << endl
+               << "                                                                rows: equations in order of declaration" << endl;
+
+      StaticOutput << "#=" << endl << comments.str() << "=#" << endl
                    << "  @assert size(g2) == (" << equations.size() << ", " << g2ncols << ")" << endl
                    << "  static!(y, x, params, residual, g1)" << endl;
       if (second_derivatives.size())
@@ -1501,14 +1512,13 @@ StaticModel::writeStaticModel(ostream &StaticOutput, bool use_dll, bool julia) c
                    << "params::Vector{Float64}," << endl
                    << "                 residual::Vector{Float64}, g1::Matrix{Float64}, "
                    << "g2::Matrix{Float64}," << endl
-                   << "                 g3::Matrix{Float64})" << endl
-                   << "  #" << endl
-                   << "  # Function argument sizes:" << endl
-                   << "  # residual: Array(Float64, model.eq_nbr, 1)" << endl
-                   << "  # g1: Array(Float64, model.eq_nbr, length(model.endo))" << endl
-                   << "  # g2: spzeros(model.eq_nbr, length(model.endo)^2)" << endl
-                   << "  # g3: spzeros(model.eq_nbr, length(model.endo)^3)" << endl
-                   << "  #" << endl << endl
+                   << "                 g3::Matrix{Float64})" << endl;
+
+      comments << " 7 g3:        spzeros(model.eq_nbr, length(model.endo)^3)       Third derivatives matrix of the static model equations;" << endl
+               << "                                                                columns: variables in declaration order" << endl
+               << "                                                                rows: equations in order of declaration" << endl;
+
+      StaticOutput << "#=" << endl << comments.str() << "=#" << endl
                    << "  @assert size(g3) == (" << nrows << ", " << ncols << ")" << endl
                    << "  static!(y, x, params, residual, g1, g2)" << endl;
       if (third_derivatives.size())
@@ -1644,7 +1654,11 @@ StaticModel::writeStaticJuliaFile(const string &basename) const
       exit(EXIT_FAILURE);
     }
 
-  output << "module " << basename << "Static" << endl << endl
+  output << "module " << basename << "Static" << endl
+         << "#" << endl
+         << "# NB: this file was automatically generated by Dynare" << endl
+         << "#     from " << basename << ".mod" << endl
+         << "#" << endl
          << "using Utils" << endl << endl
          << "export static!" << endl << endl;
   writeStaticModel(output, false, true);
@@ -2108,7 +2122,11 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
                      << "% Warning : this file is generated automatically by Dynare" << endl
                      << "%           from model file (.mod)" << endl << endl;
   else
-    paramsDerivsFile << "module " << basename << "StaticParamsDerivs" << endl << endl
+    paramsDerivsFile << "module " << basename << "StaticParamsDerivs" << endl
+                     << "#" << endl
+                     << "# NB: this file was automatically generated by Dynare" << endl
+                     << "#     from " << basename << ".mod" << endl
+                     << "#" << endl
                      << "export params_derivs" << endl << endl
                      << "function params_derivs(y, x, params)" << endl;
 
diff --git a/preprocessor/SteadyStateModel.cc b/preprocessor/SteadyStateModel.cc
index 1613893e40e9f35000d180b4fceeea10826c2b40..c94590cf1be6a017efcb56648c8f37bf84f916cd 100644
--- a/preprocessor/SteadyStateModel.cc
+++ b/preprocessor/SteadyStateModel.cc
@@ -127,7 +127,11 @@ SteadyStateModel::writeSteadyStateFile(const string &basename, bool ramsey_model
            << "% Steady state generated by Dynare preprocessor" << endl
            << "    info = 0;" << endl;
   else
-    output << "module " << basename << "SteadyState2" << endl << endl
+    output << "module " << basename << "SteadyState2" << endl
+           << "#" << endl
+           << "# NB: this file was automatically generated by Dynare" << endl
+           << "#     from " << basename << ".mod" << endl
+           << "#" << endl
            << "export steady_state!" << endl << endl
            << "function steady_state!(ys_::Vector{Float64}, exo_::Vector{Float64}, "
            << "params::Vector{Float64})" << endl;