diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index 1fa87a1f014416fd2df2573945e3e498276e1461..bbc457ced77ca563df8e92f211fac31d533dc405 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -2744,7 +2744,7 @@ DynamicModel::writeBlockDriverOutput(ostream &output, const string &basename,
              << "M_.block_structure.block(" << blk+1 << ").n_forward = " << blocks[blk].n_forward << ";" << endl
              << "M_.block_structure.block(" << blk+1 << ").n_backward = " << blocks[blk].n_backward << ";" << endl
              << "M_.block_structure.block(" << blk+1 << ").n_mixed = " << blocks[blk].n_mixed << ";" << endl
-             << "M_.block_structure.block(" << blk+1 << ").is_linear = " << (blocks[blk].linear ? "true" : "false" ) << ';' << endl
+             << "M_.block_structure.block(" << blk+1 << ").is_linear = " << boolalpha << blocks[blk].linear << ';' << endl
              << "M_.block_structure.block(" << blk+1 << ").NNZDerivatives = " << blocks_derivatives[blk].size() << ';' << endl;
     }
 
@@ -3011,7 +3011,7 @@ DynamicModel::writeDriverOutput(ostream &output, const string &basename, bool bl
   /* Say if static and dynamic models differ (because of [static] and [dynamic]
      equation tags) */
   output << "M_.static_and_dynamic_models_differ = "
-         << (static_only_equations.size() > 0 ? "true" : "false")
+         << boolalpha << (static_only_equations.size() > 0)
          << ";" << endl;
 
   // Say if model contains an external function call
@@ -3022,8 +3022,7 @@ DynamicModel::writeDriverOutput(ostream &output, const string &basename, bool bl
         has_external_function = true;
         break;
       }
-  output << "M_.has_external_function = "
-         << (has_external_function ? "true" : "false")
+  output << "M_.has_external_function = " << boolalpha << has_external_function
          << ';' << endl;
 
   // Compute list of state variables, ordered in block-order
diff --git a/src/ModFile.cc b/src/ModFile.cc
index 2c468a4792cf25712dbf03c3679c88fb6c241137..3a3b9371d2a4e3d654a2f7b282bef695339403ec 100644
--- a/src/ModFile.cc
+++ b/src/ModFile.cc
@@ -924,12 +924,11 @@ ModFile::writeMOutput(const string &basename, bool clear_all, bool clear_global,
               << "M_.heteroskedastic_shocks.Qvalue_orig = [];" << endl
               << "M_.heteroskedastic_shocks.Qscale_orig = [];" << endl;
 
-  auto to_matlab_logical = [](bool m) { return m ? "true" : "false"; };
-
-  mOutputFile << "options_.linear = " << to_matlab_logical(linear) << ";" << endl
-              << "options_.block = " << to_matlab_logical(block) << ";" << endl
-              << "options_.bytecode = " << to_matlab_logical(bytecode) << ";" << endl
-              << "options_.use_dll = " << to_matlab_logical(use_dll) << ";" << endl;
+  mOutputFile << boolalpha
+              << "options_.linear = " << linear << ";" << endl
+              << "options_.block = " << block << ";" << endl
+              << "options_.bytecode = " << bytecode << ";" << endl
+              << "options_.use_dll = " << use_dll << ";" << endl;
 
   if (parallel_local_files.size() > 0)
     {
diff --git a/src/Shocks.cc b/src/Shocks.cc
index 62e50d988d1b2bf9d0046bae9783430de6b3823c..b9b3f13d41d953c0fe3369563a3b4b4921277838 100644
--- a/src/Shocks.cc
+++ b/src/Shocks.cc
@@ -47,9 +47,10 @@ AbstractShocksStatement::writeDetShocks(ostream &output) const
       for (const auto &[period1, period2, value] : shock_vec)
         {
           output << "M_.det_shocks = [ M_.det_shocks;" << endl
-                 << "struct('exo_det'," << (exo_det ? "true" : "false")
+                 << boolalpha
+                 << "struct('exo_det'," << exo_det
                  << ",'exo_id'," << symbol_table.getTypeSpecificID(id)+1
-                 << ",'multiplicative'," << (mshocks ? "true" : "false")
+                 << ",'multiplicative'," << mshocks
                  << ",'periods'," << period1 << ":" << period2
                  << ",'value',";
           value->writeOutput(output);
@@ -148,7 +149,7 @@ void
 ShocksStatement::writeJsonOutput(ostream &output) const
 {
   output << R"({"statementName": "shocks")"
-         << R"(, "overwrite": )" << (overwrite ? "true" : "false");
+         << R"(, "overwrite": )" << boolalpha << overwrite;
   if (!det_shocks.empty())
     {
       output << ", ";
@@ -419,7 +420,7 @@ void
 MShocksStatement::writeJsonOutput(ostream &output) const
 {
   output << R"({"statementName": "mshocks")"
-         << R"(, "overwrite": )" << (overwrite ? "true" : "false");
+         << R"(, "overwrite": )" << boolalpha << overwrite;
   if (!det_shocks.empty())
     {
       output << ", ";
@@ -550,7 +551,7 @@ ShocksLearntInStatement::writeJsonOutput(ostream &output) const
 {
   output << R"({"statementName": "shocks")"
          << R"(, "learnt_in": )" << learnt_in_period
-         << R"(, "overwrite": )" << (overwrite ? "true" : "false")
+         << R"(, "overwrite": )" << boolalpha << overwrite
          << R"(, "learnt_shocks": [)";
   for (auto it = learnt_shocks.begin(); it != learnt_shocks.end(); ++it)
     {
@@ -912,7 +913,7 @@ void
 HeteroskedasticShocksStatement::writeJsonOutput(ostream &output) const
 {
   output << R"({"statementName": "heteroskedastic_shocks")"
-         << R"(, "overwrite": )" << (overwrite ? "true" : "false")
+         << R"(, "overwrite": )" << boolalpha << overwrite
          << R"(, "shocks_values": [)";
   for (auto it = values.begin(); it != values.end(); ++it)
     {
diff --git a/src/SubModel.cc b/src/SubModel.cc
index cc3074e6db630ef5a57628962618e32a53f7bd83..0fd6f5ec4024292b5486a0356762ca4fe033775a 100644
--- a/src/SubModel.cc
+++ b/src/SubModel.cc
@@ -293,8 +293,8 @@ TrendComponentModelTable::writeOutput(const string &basename, ostream &output) c
         output << it << " ";
       output << "];" << endl
              << "M_.trend_component." << name << ".diff = [";
-      for (const auto &it : diff.at(name))
-        output << (it ? "true" : "false") << " ";
+      for (bool it : diff.at(name))
+        output << boolalpha << it << " ";
       output << "];" << endl
              << "M_.trend_component." << name << ".orig_diff_var = [";
       for (auto it : orig_diff_var.at(name))
@@ -460,7 +460,7 @@ VarModelTable::writeOutput(const string &basename, ostream &output) const
   for (const auto &name : names)
     {
       output << "M_.var." << name << ".model_name = '" << name << "';" << endl
-             << "M_.var." << name << ".structural = " << (structural.at(name) ? "true" : "false") << ";" << endl
+             << "M_.var." << name << ".structural = " << boolalpha << structural.at(name) << ";" << endl
              << "M_.var." << name << ".eqtags = {";
       for (const auto &it : eqtags.at(name))
         output << "'" << it << "'; ";
@@ -478,8 +478,8 @@ VarModelTable::writeOutput(const string &basename, ostream &output) const
         output << it << " ";
       output << "];" << endl
              << "M_.var." << name << ".diff = [";
-      for (const auto &it : diff.at(name))
-        output << (it ? "true" : "false") << " ";
+      for (bool it : diff.at(name))
+        output << boolalpha << it << " ";
       output << "];" << endl
              << "M_.var." << name << ".nonstationary = M_.var." << name << ".diff;" << endl
              << "M_.var." << name << ".orig_diff_var = [";
@@ -1491,7 +1491,7 @@ PacModelTable::writeOutput(const string &basename, ostream &output) const
       output << "];" << endl
              << "M_.pac." << name << ".ec.istarget = [";
       for (auto it : ec_params_and_vars.second)
-        output << (get<1>(it) ? "true " : "false ");
+        output << boolalpha << get<1>(it) << " ";
       output << "];" << endl
              << "M_.pac." << name << ".ec.scale = [";
       for (auto it : ec_params_and_vars.second)