diff --git a/src/DynareBison.yy b/src/DynareBison.yy
index 4ed6092d060b4d6104db7420af959c4c3ddba4c3..96ae5857307a4b33a7112add36f63f87e403fc2f 100644
--- a/src/DynareBison.yy
+++ b/src/DynareBison.yy
@@ -18,8 +18,10 @@
  */
 
 %language "c++"
-%require "2.5"
+%require "3.0"
 %defines
+%define api.value.type variant
+%define parse.assert
 
 %code top {
 class ParsingDriver;
@@ -45,19 +47,6 @@ class ParsingDriver;
 %debug
 %error-verbose
 
-%union
-{
-  string *string_val;
-  expr_t node_val;
-  SymbolType symbol_type_val;
-  vector<string> *vector_string_val;
-  vector<string *> *vector_string_p_val;
-  vector<int> *vector_int_val;
-  pair<string *, string *> *string_pair_val;
-  vector<pair<string *, string *> *> *vector_string_pair_val;
-  PriorDistributions prior_distributions_val;
-};
-
 %code {
 /* Little hack: we redefine the macro which computes the locations, because
    we need to access the location from within the parsing driver for error
@@ -96,13 +85,13 @@ class ParsingDriver;
 %token DATAFILE FILE SERIES DOUBLING DR_CYCLE_REDUCTION_TOL DR_LOGARITHMIC_REDUCTION_TOL DR_LOGARITHMIC_REDUCTION_MAXITER DR_ALGO DROP DSAMPLE DYNASAVE DYNATYPE CALIBRATION DIFFERENTIATE_FORWARD_VARS
 %token END ENDVAL EQUAL ESTIMATION ESTIMATED_PARAMS ESTIMATED_PARAMS_BOUNDS ESTIMATED_PARAMS_INIT EXTENDED_PATH ENDOGENOUS_PRIOR
 %token FILENAME DIRNAME FILTER_STEP_AHEAD FILTERED_VARS FIRST_OBS LAST_OBS SET_TIME OSR_PARAMS_BOUNDS KEEP_KALMAN_ALGO_IF_SINGULARITY_IS_DETECTED
-%token <string_val> FLOAT_NUMBER DATES
+%token <string> FLOAT_NUMBER DATES
 %token DEFAULT FIXED_POINT OPT_ALGO
 %token FORECAST K_ORDER_SOLVER INSTRUMENTS SHIFT MEAN STDEV VARIANCE MODE INTERVAL SHAPE DOMAINN
 %token GAMMA_PDF GRAPH GRAPH_FORMAT CONDITIONAL_VARIANCE_DECOMPOSITION NOCHECK STD
 %token HISTVAL HISTVAL_FILE HOMOTOPY_SETUP HOMOTOPY_MODE HOMOTOPY_STEPS HOMOTOPY_FORCE_CONTINUE HP_FILTER HP_NGRID HYBRID ONE_SIDED_HP_FILTER
 %token IDENTIFICATION INF_CONSTANT INITVAL INITVAL_FILE BOUNDS JSCALE INIT INFILE INVARS
-%token <string_val> INT_NUMBER
+%token <string> INT_NUMBER
 %token INV_GAMMA_PDF INV_GAMMA1_PDF INV_GAMMA2_PDF IRF IRF_SHOCKS IRF_PLOT_THRESHOLD IRF_CALIBRATION
 %token FAST_KALMAN_FILTER KALMAN_ALGO KALMAN_TOL DIFFUSE_KALMAN_TOL SUBSAMPLES OPTIONS TOLF TOLX PLOT_INIT_DATE PLOT_END_DATE
 %token LAPLACE LIK_ALGO LIK_INIT LINEAR LOAD_IDENT_FILES LOAD_MH_FILE LOAD_RESULTS_AFTER_LOAD_MH LOAD_PARAMS_AND_STEADY_STATE LOGLINEAR LOGDATA LYAPUNOV LINEAR_APPROXIMATION
@@ -113,7 +102,7 @@ class ParsingDriver;
 %token NUMBER_OF_PARTICLES RESAMPLING SYSTEMATIC GENERIC RESAMPLING_THRESHOLD RESAMPLING_METHOD KITAGAWA STRATIFIED SMOOTH
 %token CPF_WEIGHTS AMISANOTRISTANI MURRAYJONESPARSLOW WRITE_EQUATION_TAGS METHOD
 %token NONLINEAR_FILTER_INITIALIZATION FILTER_ALGORITHM PROPOSAL_APPROXIMATION CUBATURE UNSCENTED MONTECARLO DISTRIBUTION_APPROXIMATION
-%token <string_val> NAME
+%token <string> NAME
 %token USE_PENALIZED_OBJECTIVE_FOR_HESSIAN INIT_STATE FAST_REALTIME RESCALE_PREDICTION_ERROR_COVARIANCE GENERATE_IRFS
 %token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NODISPLAY NOCORR NODIAGNOSTIC NOFUNCTIONS NO_HOMOTOPY VAR_MODEL_NAME
 %token NOGRAPH POSTERIOR_NOGRAPH POSTERIOR_GRAPH NOMOMENTS NOPRINT NORMAL_PDF SAVE_DRAWS MODEL_NAME STDERR_MULTIPLES DIAGONAL_ONLY
@@ -121,14 +110,14 @@ class ParsingDriver;
 %token PARALLEL_LOCAL_FILES PARAMETERS PARAMETER_SET PARTIAL_INFORMATION PERIODS PERIOD PLANNER_OBJECTIVE PLOT_CONDITIONAL_FORECAST PLOT_PRIORS PREFILTER PRESAMPLE
 %token PERFECT_FORESIGHT_SETUP PERFECT_FORESIGHT_SOLVER NO_POSTERIOR_KERNEL_DENSITY FUNCTION
 %token PRINT PRIOR_MC PRIOR_TRUNC PRIOR_MODE PRIOR_MEAN POSTERIOR_MODE POSTERIOR_MEAN POSTERIOR_MEDIAN MLE_MODE PRUNING
-%token <string_val> QUOTED_STRING
+%token <string> QUOTED_STRING
 %token QZ_CRITERIUM QZ_ZERO_THRESHOLD FULL DSGE_VAR DSGE_VARLAG DSGE_PRIOR_WEIGHT TRUNCATE PIPE_E PIPE_X PIPE_P
 %token RELATIVE_IRF REPLIC SIMUL_REPLIC RPLOT SAVE_PARAMS_AND_STEADY_STATE PARAMETER_UNCERTAINTY
 %token SHOCKS SHOCK_DECOMPOSITION SHOCK_GROUPS USE_SHOCK_GROUPS SIGMA_E SIMUL SIMUL_ALGO SIMUL_SEED ENDOGENOUS_TERMINAL_PERIOD
 %token SMOOTHER SMOOTHER2HISTVAL SQUARE_ROOT_SOLVER STACK_SOLVE_ALGO STEADY_STATE_MODEL SOLVE_ALGO SOLVER_PERIODS ROBUST_LIN_SOLVE
 %token STDERR STEADY STOCH_SIMUL SURPRISE SYLVESTER SYLVESTER_FIXED_POINT_TOL REGIMES REGIME REALTIME_SHOCK_DECOMPOSITION
 %token TEX RAMSEY_MODEL RAMSEY_POLICY RAMSEY_CONSTRAINTS PLANNER_DISCOUNT DISCRETIONARY_POLICY DISCRETIONARY_TOL
-%token <string_val> TEX_NAME
+%token <string> TEX_NAME
 %token UNIFORM_PDF UNIT_ROOT_VARS USE_DLL USEAUTOCORR GSA_SAMPLE_FILE USE_UNIVARIATE_FILTERS_IF_SINGULARITY_IS_DETECTED
 %token VALUES VAR VAREXO VAREXO_DET VAROBS VAREXOBS PREDETERMINED_VARIABLES VAR_EXPECTATION PLOT_SHOCK_DECOMPOSITION MODEL_LOCAL_VARIABLE
 %token WRITE_LATEX_DYNAMIC_MODEL WRITE_LATEX_STATIC_MODEL WRITE_LATEX_ORIGINAL_MODEL CROSSEQUATIONS COVARIANCE WRITE_LATEX_STEADY_STATE_MODEL
@@ -151,7 +140,7 @@ class ParsingDriver;
 %token VLISTLOG VLISTPER SPECTRAL_DENSITY
 %token RESTRICTION RESTRICTION_FNAME CROSS_RESTRICTIONS NLAGS CONTEMP_REDUCED_FORM REAL_PSEUDO_FORECAST
 %token DUMMY_OBS NSTATES INDXSCALESSTATES NO_BAYESIAN_PRIOR SPECIFICATION SIMS_ZHA
-%token <string_val> ALPHA BETA ABAND NINV CMS NCMS CNUM GAMMA INV_GAMMA INV_GAMMA1 INV_GAMMA2 NORMAL UNIFORM EPS PDF FIG DR NONE PRIOR PRIOR_VARIANCE HESSIAN IDENTITY_MATRIX DIRICHLET DIAGONAL OPTIMAL
+%token <string> ALPHA BETA ABAND NINV CMS NCMS CNUM GAMMA INV_GAMMA INV_GAMMA1 INV_GAMMA2 NORMAL UNIFORM EPS PDF FIG DR NONE PRIOR PRIOR_VARIANCE HESSIAN IDENTITY_MATRIX DIRICHLET DIAGONAL OPTIMAL
 %token GSIG2_LMDM Q_DIAG FLAT_PRIOR NCSK NSTD WEIBULL WEIBULL_PDF
 %token INDXPARR INDXOVR INDXAP APBAND INDXIMF IMFBAND INDXFORE FOREBAND INDXGFOREHAT INDXGIMFHAT
 %token INDXESTIMA INDXGDLS EQ_MS FILTER_COVARIANCE FILTER_DECOMPOSITION SMOOTHED_STATE_UNCERTAINTY
@@ -179,22 +168,23 @@ class ParsingDriver;
 %token SIMULATION_MULTIPLE SEED BOUNDED_SHOCK_SUPPORT EQTAGS
 %token ANALYTICAL_GIRF IRF_IN_PERCENT EMAS_GIRF EMAS_DROP EMAS_TOLF EMAS_MAX_ITER
 
-%token <vector_string_p_val> SYMBOL_VEC
-
-%type <node_val> expression expression_or_empty
-%type <node_val> equation hand_side
-%type <string_val> non_negative_number signed_number signed_integer date_str
-%type <string_val> filename symbol vec_of_vec_value vec_value_list date_expr number
-%type <string_val> vec_value_1 vec_value signed_inf signed_number_w_inf
-%type <string_val> range vec_value_w_inf vec_value_1_w_inf
-%type <string_val> integer_range signed_integer_range sub_sampling_options list_sub_sampling_option
-%type <string_pair_val> named_var_elem
-%type <vector_string_pair_val> named_var named_var_1
-%type <symbol_type_val> change_type_arg
-%type <vector_string_val> vec_str vec_str_1
-%type <vector_string_p_val> change_type_var_list subsamples_eq_opt prior_eq_opt options_eq_opt calibration_range
-%type <vector_int_val> vec_int_elem vec_int_1 vec_int vec_int_number
-%type <prior_distributions_val> prior_pdf prior_distribution
+%token <vector<string>> SYMBOL_VEC
+
+%type <expr_t> expression expression_or_empty
+%type <expr_t> equation hand_side
+%type <string> non_negative_number signed_number signed_integer date_str
+%type <string> filename symbol vec_of_vec_value vec_value_list date_expr number
+%type <string> vec_value_1 vec_value signed_inf signed_number_w_inf
+%type <string> range vec_value_w_inf vec_value_1_w_inf
+%type <string> integer_range signed_integer_range sub_sampling_options list_sub_sampling_option
+%type <pair<string,string>> named_var_elem subsamples_eq_opt calibration_range
+%type <vector<pair<string,string>>> named_var named_var_1
+%type <SymbolType> change_type_arg
+%type <vector<string>> vec_str vec_str_1
+%type <vector<string>> change_type_var_list
+%type <vector<int>> vec_int_elem vec_int_1 vec_int vec_int_number
+%type <PriorDistributions> prior_pdf prior_distribution
+%type <tuple<string,string,string,string>> prior_eq_opt options_eq_opt
 %%
 
 %start statement_list;
@@ -410,7 +400,7 @@ restriction : EXCLUSION LAG INT_NUMBER ';' restriction_exclusion_equation_list
             | RESTRICTION EQUATION '(' symbol ')' restriction_equation_equality ';'
               { driver.add_VAR_restriction_equation_or_crossequation_final($4); }
             | RESTRICTION CROSSEQUATIONS restriction_crossequation_equality ';'
-              { driver.add_VAR_restriction_equation_or_crossequation_final(NULL); }
+              { driver.add_VAR_restriction_equation_or_crossequation_final(""); }
             | RESTRICTION COVARIANCE '(' symbol COMMA symbol ')' EQUAL number ';'
               { driver.add_VAR_covariance_number_restriction($4, $6, $9); }
             | RESTRICTION COVARIANCE '(' symbol COMMA symbol ')' EQUAL '(' symbol COMMA symbol ')' ';'
@@ -432,14 +422,13 @@ restriction_equation_equality_side : coeff_def TIMES expression
                                      { driver.add_VAR_restriction_eq_or_crosseq($3); }
                                    | coeff_def DIVIDE expression
                                      {
-                                       string *onestr = new string("1");
-                                       expr_t one = driver.add_non_negative_constant(onestr);
+                                       expr_t one = driver.add_non_negative_constant("1");
                                        driver.add_VAR_restriction_eq_or_crosseq(driver.add_divide(one, $3));
                                      }
                                    ;
 
 coeff_def : COEFF '(' symbol COMMA INT_NUMBER ')'
-            { driver.add_VAR_restriction_coeff($3, NULL, $5); }
+            { driver.add_VAR_restriction_coeff($3, "", $5); }
           ;
 
 
@@ -458,8 +447,7 @@ restriction_crossequation_equality_side : coeff_def1 TIMES expression
                                           { driver.add_VAR_restriction_eq_or_crosseq($3); }
                                         | coeff_def1 DIVIDE expression
                                           {
-                                            string *onestr = new string("1");
-                                            expr_t one = driver.add_non_negative_constant(onestr);
+                                            expr_t one = driver.add_non_negative_constant("1");
                                             driver.add_VAR_restriction_eq_or_crosseq(driver.add_divide(one, $3));
                                           }
                                         ;
@@ -495,11 +483,11 @@ nonstationary_var_list : nonstationary_var_list symbol
                        | symbol
                          { driver.declare_nonstationary_var($1); }
                        |  nonstationary_var_list symbol named_var
-                         { driver.declare_nonstationary_var($2, NULL, $3); }
+                         { driver.declare_nonstationary_var($2, "", $3); }
                        | nonstationary_var_list COMMA symbol named_var
-                         { driver.declare_nonstationary_var($3, NULL, $4); }
+                         { driver.declare_nonstationary_var($3, "", $4); }
                        | symbol named_var
-                         { driver.declare_nonstationary_var($1, NULL, $2); }
+                         { driver.declare_nonstationary_var($1, "", $2); }
                        | nonstationary_var_list symbol TEX_NAME
                          { driver.declare_nonstationary_var($2, $3); }
                        | nonstationary_var_list COMMA symbol TEX_NAME
@@ -525,35 +513,28 @@ parameters : PARAMETERS parameter_list ';';
 model_local_variable : MODEL_LOCAL_VARIABLE model_local_variable_list ';';
 
 named_var_elem : symbol EQUAL QUOTED_STRING
-               {
-                  pair<string *, string *> *pr = new pair<string *, string *>($1, $3);
-                  $$ = pr;
-               }
+               { $$ = make_pair($1, $3); }
 
 named_var_1 : '(' named_var_elem
-              {
-                $$ = new vector<pair<string *, string *> *>();
-                $$->push_back($2);
-              }
+              { $$ = vector<pair<string, string>>{$2}; }
             | '(' COMMA named_var_elem
-              {
-                $$ = new vector<pair<string *, string *> *>();
-                $$->push_back($3);
-              }
+              { $$ = vector<pair<string, string>>{$3}; }
             | named_var_1 named_var_elem
               {
-                $1->push_back($2);
                 $$ = $1;
+                $$.push_back($2);
               }
             | named_var_1 COMMA named_var_elem
               {
-                $1->push_back($3);
                 $$ = $1;
+                $$.push_back($3);
               }
             ;
 
-named_var : named_var_1 ')' { $$ = $1; }
-          | named_var_1 COMMA ')' { $$ = $1; }
+named_var : named_var_1 ')'
+            { $$ = $1; }
+          | named_var_1 COMMA ')'
+            { $$ = $1; }
           ;
 
 var_list : var_list symbol
@@ -563,11 +544,11 @@ var_list : var_list symbol
          | symbol
            { driver.declare_endogenous($1); }
          | var_list symbol named_var
-           { driver.declare_endogenous($2, NULL, $3); }
+           { driver.declare_endogenous($2, "", $3); }
          | var_list COMMA symbol named_var
-           { driver.declare_endogenous($3, NULL, $4); }
+           { driver.declare_endogenous($3, "", $4); }
          | symbol named_var
-           { driver.declare_endogenous($1, NULL, $2); }
+           { driver.declare_endogenous($1, "", $2); }
          | var_list symbol TEX_NAME
            { driver.declare_endogenous($2, $3); }
          | var_list COMMA symbol TEX_NAME
@@ -589,11 +570,11 @@ varexo_list : varexo_list symbol
             | symbol
               { driver.declare_exogenous($1); }
             | varexo_list symbol named_var
-              { driver.declare_exogenous($2, NULL, $3); }
+              { driver.declare_exogenous($2, "", $3); }
             | varexo_list COMMA symbol named_var
-              { driver.declare_exogenous($3, NULL, $4); }
+              { driver.declare_exogenous($3, "", $4); }
             | symbol named_var
-              { driver.declare_exogenous($1, NULL, $2); }
+              { driver.declare_exogenous($1, "", $2); }
             | varexo_list symbol TEX_NAME
               { driver.declare_exogenous($2, $3); }
             | varexo_list COMMA symbol TEX_NAME
@@ -615,11 +596,11 @@ varexo_det_list : varexo_det_list symbol
                 | symbol
                   { driver.declare_exogenous_det($1); }
                 | varexo_det_list symbol named_var
-                  { driver.declare_exogenous_det($2, NULL, $3); }
+                  { driver.declare_exogenous_det($2, "", $3); }
                 | varexo_det_list COMMA symbol named_var
-                  { driver.declare_exogenous_det($3, NULL, $4); }
+                  { driver.declare_exogenous_det($3, "", $4); }
                 | symbol named_var
-                  { driver.declare_exogenous_det($1, NULL, $2); }
+                  { driver.declare_exogenous_det($1, "", $2); }
                 | varexo_det_list symbol TEX_NAME
                   { driver.declare_exogenous_det($2, $3); }
                 | varexo_det_list COMMA symbol TEX_NAME
@@ -641,11 +622,11 @@ parameter_list : parameter_list symbol
                | symbol
                  { driver.declare_parameter($1); }
                | parameter_list symbol named_var
-                 { driver.declare_parameter($2, NULL, $3); }
+                 { driver.declare_parameter($2, "", $3); }
                | parameter_list COMMA symbol named_var
-                 { driver.declare_parameter($3, NULL, $4); }
+                 { driver.declare_parameter($3, "", $4); }
                | symbol named_var
-                 { driver.declare_parameter($1, NULL, $2); }
+                 { driver.declare_parameter($1, "", $2); }
                | parameter_list symbol TEX_NAME
                  { driver.declare_parameter($2, $3); }
                | parameter_list COMMA symbol TEX_NAME
@@ -697,11 +678,17 @@ change_type_arg : PARAMETERS
                 ;
 
 change_type_var_list : symbol
-                       { $$ = new vector<string *>(); $$->push_back($1); }
+                       { $$ = vector<string>{$1}; }
                      | change_type_var_list symbol
-                       { $$ = $1; $1->push_back($2); }
+                       {
+                         $$ = $1;
+                         $$.push_back($2);
+                       }
                      | change_type_var_list COMMA symbol
-                       { $$ = $1; $1->push_back($3); }
+                       {
+                         $$ = $1;
+                         $$.push_back($3);
+                       }
                      ;
 
 periods : PERIODS INT_NUMBER ';'
@@ -801,6 +788,7 @@ comma_expression : expression
 expression_or_empty : %empty
                       { $$ = driver.add_nan_constant(); }
                     | expression
+                      { $$ = $1; }
 	            ;
 
 initval : INITVAL ';' initval_list END ';'
@@ -886,7 +874,7 @@ tags_list : tags_list COMMA tag_pair
 tag_pair : NAME EQUAL QUOTED_STRING
            { driver.add_equation_tags($1, $3); }
          | NAME
-           { driver.add_equation_tags($1, new string()); }
+           { driver.add_equation_tags($1, ""); }
          ;
 
 hand_side : '(' hand_side ')'
@@ -926,7 +914,7 @@ hand_side : '(' hand_side ')'
           | EXPECTATION '(' signed_integer ')''(' hand_side ')'
 	    { $$ = driver.add_expectation($3, $6); }
           | VAR_EXPECTATION '(' symbol COMMA MODEL_NAME EQUAL NAME ')'
-            { $$ = driver.add_var_expectation($3, new string("1"), $7); }
+            { $$ = driver.add_var_expectation($3, "1", $7); }
           | VAR_EXPECTATION '(' symbol COMMA INT_NUMBER COMMA MODEL_NAME EQUAL NAME ')'
             { $$ = driver.add_var_expectation($3, $5, $9); }
           | PAC_EXPECTATION '(' symbol ')'
@@ -940,7 +928,7 @@ hand_side : '(' hand_side ')'
           | DIFF '(' hand_side ')'
             { $$ = driver.add_diff($3); }
           | ADL '(' hand_side COMMA QUOTED_STRING ')'
-            { $$ = driver.add_adl($3, $5, new string("1")); }
+            { $$ = driver.add_adl($3, $5, "1"); }
           | ADL '(' hand_side COMMA QUOTED_STRING COMMA INT_NUMBER ')'
             { $$ = driver.add_adl($3, $5, $7); }
           | ADL '(' hand_side COMMA QUOTED_STRING COMMA vec_int ')'
@@ -1472,40 +1460,49 @@ symbol_list : symbol_list symbol
 
 symbol_list_ext : symbol_list
                 | ':'
-                  {
-                    string *colon = new string(":");
-                    driver.add_in_symbol_list(colon);
-                  }
+                  { driver.add_in_symbol_list(":"); }
                 ;
 
 signed_integer : PLUS INT_NUMBER
                  { $$ = $2; }
                | MINUS INT_NUMBER
-                { $2->insert(0, "-"); $$ = $2; }
+                 {
+                   $$ = $2;
+                   $$.insert(0, "-");
+                 }
                | INT_NUMBER
+                 { $$ = $1; }
                ;
 
 non_negative_number : INT_NUMBER
+                      { $$ = $1; }
                     | FLOAT_NUMBER
+                      { $$ = $1; }
                     ;
 
 signed_number : PLUS non_negative_number
                { $$ = $2; }
               | MINUS non_negative_number
-               { $2->insert(0, "-"); $$ = $2; }
+               {
+                 $$ = $2;
+                 $$.insert(0, "-");
+               }
               | non_negative_number
+               { $$ = $1; }
               ;
 
 signed_inf : PLUS INF_CONSTANT
-             { $$ = new string ("Inf"); }
+             { $$ = "Inf"; }
            | MINUS INF_CONSTANT
-             { $$ = new string ("-Inf"); }
+             { $$ = "-Inf"; }
            | INF_CONSTANT
-             { $$ = new string ("Inf"); }
+             { $$ = "Inf"; }
            ;
 
 signed_number_w_inf : signed_inf
+                      { $$ = $1; }
                     | signed_number
+                      { $$ = $1; }
                     ;
 
 estimated_params : ESTIMATED_PARAMS ';' estimated_list END ';' { driver.estimated_params(); };
@@ -1522,22 +1519,18 @@ estimated_elem : estimated_elem1 COMMA estimated_elem2 ';'
 estimated_elem1 : STDERR symbol
                   {
                     driver.estim_params.type = 1;
-                    driver.estim_params.name = *$2;
-                    delete $2;
+                    driver.estim_params.name = $2;
                   }
                 | symbol
                   {
                     driver.estim_params.type = 2;
-                    driver.estim_params.name = *$1;
-                    delete $1;
+                    driver.estim_params.name = $1;
                   }
                 | CORR symbol COMMA symbol
                   {
                     driver.estim_params.type = 3;
-                    driver.estim_params.name = *$2;
-                    driver.estim_params.name2 = *$4;
-                    delete $2;
-                    delete $4;
+                    driver.estim_params.name = $2;
+                    driver.estim_params.name2 = $4;
                   }
                 | DSGE_PRIOR_WEIGHT
                   {
@@ -1619,25 +1612,21 @@ estimated_init_list : estimated_init_list estimated_init_elem
 estimated_init_elem : STDERR symbol COMMA expression ';'
                       {
                         driver.estim_params.type = 1;
-                        driver.estim_params.name = *$2;
+                        driver.estim_params.name = $2;
                         driver.estim_params.init_val = $4;
-                        delete $2;
                       }
                     | CORR symbol COMMA symbol COMMA expression ';'
                       {
                         driver.estim_params.type = 3;
-                        driver.estim_params.name = *$2;
-                        driver.estim_params.name2 = *$4;
+                        driver.estim_params.name = $2;
+                        driver.estim_params.name2 = $4;
                         driver.estim_params.init_val = $6;
-                        delete $2;
-                        delete $4;
                       }
                     | symbol COMMA expression ';'
                       {
                         driver.estim_params.type = 2;
-                        driver.estim_params.name = *$1;
+                        driver.estim_params.name = $1;
                         driver.estim_params.init_val = $3;
-                        delete $1;
                       }
                     ;
 
@@ -1653,28 +1642,24 @@ estimated_bounds_list : estimated_bounds_list estimated_bounds_elem
 estimated_bounds_elem : STDERR symbol COMMA expression COMMA expression ';'
                         {
                           driver.estim_params.type = 1;
-                          driver.estim_params.name = *$2;
+                          driver.estim_params.name = $2;
                           driver.estim_params.low_bound = $4;
                           driver.estim_params.up_bound = $6;
-                          delete $2;
                         }
                       | CORR symbol COMMA symbol COMMA expression COMMA expression ';'
                         {
                           driver.estim_params.type = 3;
-                          driver.estim_params.name = *$2;
-                          driver.estim_params.name2 = *$4;
+                          driver.estim_params.name = $2;
+                          driver.estim_params.name2 = $4;
                           driver.estim_params.low_bound = $6;
                           driver.estim_params.up_bound = $8;
-                          delete $2;
-                          delete $4;
                         }
                       | symbol COMMA expression COMMA expression ';'
                         {
                           driver.estim_params.type = 2;
-                          driver.estim_params.name = *$1;
+                          driver.estim_params.name = $1;
                           driver.estim_params.low_bound = $3;
                           driver.estim_params.up_bound = $5;
-                          delete $1;
                         }
                       ;
 
@@ -1689,10 +1674,9 @@ osr_bounds_list : osr_bounds_list osr_bounds_elem
 
 osr_bounds_elem : symbol COMMA expression COMMA expression ';'
                   {
-                    driver.osr_params.name = *$1;
+                    driver.osr_params.name = $1;
                     driver.osr_params.low_bound = $3;
                     driver.osr_params.up_bound = $5;
-                    delete $1;
                   }
                 ;
 
@@ -1734,12 +1718,13 @@ prior_pdf : BETA_PDF
             { $$ = PriorDistributions::weibull; }
           ;
 
-date_str : DATES { $$ = $1; }
+date_str : DATES
+           { $$ = $1; }
 
 date_expr : date_str
             { $$ = $1; }
           | date_expr PLUS INT_NUMBER
-            { $$ = $1; $$->append("+").append(*$3); }
+            { $$ = $1 + '+' + $3; }
           ;
 
 set_time : SET_TIME '(' date_expr ')' ';'
@@ -1764,53 +1749,37 @@ data_options : o_file
              ;
 
 subsamples : subsamples_eq_opt '(' subsamples_name_list ')' ';'
-             { driver.set_subsamples($1->at(0), $1->at(1)); }
+             { driver.set_subsamples($1.first, $1.second); }
            ;
 
 subsamples_eq : subsamples_eq_opt EQUAL subsamples_eq_opt ';'
-                {
-                  driver.copy_subsamples($1->at(0), $1->at(1), $3->at(0), $3->at(1));
-                  delete $1;
-                  delete $3;
-                }
+                { driver.copy_subsamples($1.first, $1.second, $3.first, $3.second); }
               ;
 
 subsamples_eq_opt : symbol '.' SUBSAMPLES
-                    {
-                      $$ = new vector<string *>();
-                      $$->push_back($1);
-                      $$->push_back(new string (""));
-                    }
+                    { $$ = make_pair($1, ""); }
                   | STD '(' symbol ')' '.'SUBSAMPLES
-                    {
-                      $$ = new vector<string *>();
-                      $$->push_back($3);
-                      $$->push_back(new string (""));
-                    }
+                    { $$ = make_pair($3, ""); }
                   | CORR '(' symbol COMMA symbol ')' '.' SUBSAMPLES
-                    {
-                      $$ = new vector<string *>();
-                      $$->push_back($3);
-                      $$->push_back($5);
-                    }
-                 ;
+                    { $$ = make_pair($3, $5); }
+                  ;
 
 subsamples_name_list : subsamples_name_list COMMA o_subsample_name
                      | o_subsample_name
                      ;
 
 prior : symbol '.' PRIOR { driver.set_prior_variance(); driver.prior_shape = PriorDistributions::noShape; } '(' prior_options_list ')' ';'
-        { driver.set_prior($1, new string ("")); }
+        { driver.set_prior($1, ""); }
       | symbol '.' symbol '.' PRIOR { driver.set_prior_variance(); driver.prior_shape = PriorDistributions::noShape; } '(' prior_options_list ')' ';'
         { driver.set_prior($1, $3); }
       | SYMBOL_VEC '.' PRIOR { driver.set_prior_variance(); driver.prior_shape = PriorDistributions::noShape; }  '(' joint_prior_options_list ')' ';'
         { driver.set_joint_prior($1); }
       | STD '(' symbol ')' '.' PRIOR { driver.set_prior_variance(); driver.prior_shape = PriorDistributions::noShape; } '(' prior_options_list ')' ';'
-        { driver.set_std_prior($3, new string ("")); }
+        { driver.set_std_prior($3, ""); }
       | STD '(' symbol ')' '.' symbol '.' PRIOR { driver.set_prior_variance(); driver.prior_shape = PriorDistributions::noShape; } '(' prior_options_list ')' ';'
         { driver.set_std_prior($3, $6); }
       | CORR '(' symbol COMMA symbol ')' '.' PRIOR { driver.set_prior_variance(); driver.prior_shape = PriorDistributions::noShape; } '(' prior_options_list ')' ';'
-        { driver.set_corr_prior($3, $5, new string ("")); }
+        { driver.set_corr_prior($3, $5, ""); }
       | CORR '(' symbol COMMA symbol ')' '.' symbol '.' PRIOR { driver.set_prior_variance(); driver.prior_shape = PriorDistributions::noShape; } '(' prior_options_list ')' ';'
         { driver.set_corr_prior($3, $5, $8); }
       ;
@@ -1848,74 +1817,34 @@ joint_prior_options : o_shift
                     ;
 
 prior_eq : prior_eq_opt EQUAL prior_eq_opt ';'
-           {
-             driver.copy_prior($1->at(0), $1->at(1), $1->at(2), $1->at(3),
-                               $3->at(0), $3->at(1), $3->at(2), $3->at(3));
-             delete $1;
-             delete $3;
-           }
+           { driver.copy_prior(get<0>($1), get<1>($1), get<2>($1), get<3>($1),
+                               get<0>($3), get<1>($3), get<2>($3), get<3>($3)); }
          ;
 
 prior_eq_opt : symbol '.' PRIOR
-               {
-                 $$ = new vector<string *>();
-                 $$->push_back(new string ("par"));
-                 $$->push_back($1);
-                 $$->push_back(new string (""));
-                 $$->push_back(new string (""));
-               }
+               { $$ = make_tuple("par", $1, "", ""); }
              | symbol '.' symbol '.' PRIOR
-               {
-                 $$ = new vector<string *>();
-                 $$->push_back(new string ("par"));
-                 $$->push_back($1);
-                 $$->push_back(new string (""));
-                 $$->push_back($3);
-               }
+               { $$ = make_tuple("par", $1, "", $3); }
              | STD '(' symbol ')' '.'  PRIOR
-               {
-                 $$ = new vector<string *>();
-                 $$->push_back(new string ("std"));
-                 $$->push_back($3);
-                 $$->push_back(new string (""));
-                 $$->push_back(new string (""));
-               }
+               { $$ = make_tuple("std", $3, "", ""); }
              | STD '(' symbol ')' '.' symbol '.' PRIOR
-               {
-                 $$ = new vector<string *>();
-                 $$->push_back(new string ("std"));
-                 $$->push_back($3);
-                 $$->push_back(new string (""));
-                 $$->push_back($6);
-               }
+               { $$ = make_tuple("std", $3, "", $6); }
              | CORR '(' symbol COMMA symbol ')' '.'  PRIOR
-               {
-                 $$ = new vector<string *>();
-                 $$->push_back(new string ("corr"));
-                 $$->push_back($3);
-                 $$->push_back($5);
-                 $$->push_back(new string (""));
-               }
+               { $$ = make_tuple("corr", $3, $5, ""); }
              | CORR '(' symbol COMMA symbol ')' '.' symbol '.' PRIOR
-               {
-                 $$ = new vector<string *>();
-                 $$->push_back(new string ("corr"));
-                 $$->push_back($3);
-                 $$->push_back($5);
-                 $$->push_back($8);
-               }
+               { $$ = make_tuple("corr", $3, $5, $8); }
              ;
 
 options : symbol '.' OPTIONS '(' options_options_list ')' ';'
-          { driver.set_options($1, new string ("")); }
+          { driver.set_options($1, ""); }
         | symbol '.' symbol '.' OPTIONS '(' options_options_list ')' ';'
           { driver.set_options($1, $3); }
         | STD '(' symbol ')' '.' OPTIONS '(' options_options_list ')' ';'
-          { driver.set_std_options($3, new string ("")); }
+          { driver.set_std_options($3, ""); }
         | STD '(' symbol ')' '.' symbol '.' OPTIONS '(' options_options_list ')' ';'
           { driver.set_std_options($3, $6); }
         | CORR '(' symbol COMMA symbol ')' '.' OPTIONS '(' options_options_list ')' ';'
-          { driver.set_corr_options($3, $5, new string ("")); }
+          { driver.set_corr_options($3, $5, ""); }
         | CORR '(' symbol COMMA symbol ')' '.' symbol '.' OPTIONS '(' options_options_list ')' ';'
           { driver.set_corr_options($3, $5, $8); }
         ;
@@ -1930,62 +1859,22 @@ options_options : o_jscale
                 ;
 
 options_eq : options_eq_opt EQUAL options_eq_opt ';'
-             {
-               driver.copy_options($1->at(0), $1->at(1), $1->at(2), $1->at(3),
-                                   $3->at(0), $3->at(1), $3->at(2), $3->at(3));
-               delete $1;
-               delete $3;
-             }
+             { driver.copy_prior(get<0>($1), get<1>($1), get<2>($1), get<3>($1),
+                                 get<0>($3), get<1>($3), get<2>($3), get<3>($3)); }
            ;
 
 options_eq_opt : symbol '.' OPTIONS
-                 {
-                   $$ = new vector<string *>();
-                   $$->push_back(new string ("par"));
-                   $$->push_back($1);
-                   $$->push_back(new string (""));
-                   $$->push_back(new string (""));
-                 }
+                 { $$ = make_tuple("par", $1, "", ""); }
                | symbol '.' symbol '.' OPTIONS
-                 {
-                   $$ = new vector<string *>();
-                   $$->push_back(new string ("par"));
-                   $$->push_back($1);
-                   $$->push_back(new string (""));
-                   $$->push_back($3);
-                 }
+                 { $$ = make_tuple("par", $1, "", $3); }
                | STD '(' symbol ')' '.'  OPTIONS
-                 {
-                   $$ = new vector<string *>();
-                   $$->push_back(new string ("std"));
-                   $$->push_back($3);
-                   $$->push_back(new string (""));
-                   $$->push_back(new string (""));
-                 }
+                 { $$ = make_tuple("std", $3, "", ""); }
                | STD '(' symbol ')' '.' symbol '.' OPTIONS
-                 {
-                   $$ = new vector<string *>();
-                   $$->push_back(new string ("std"));
-                   $$->push_back($3);
-                   $$->push_back(new string (""));
-                   $$->push_back($6);
-                 }
+                 { $$ = make_tuple("std", $3, "", $6); }
                | CORR '(' symbol COMMA symbol ')' '.'  OPTIONS
-                 {
-                   $$ = new vector<string *>();
-                   $$->push_back(new string ("corr"));
-                   $$->push_back($3);
-                   $$->push_back($5);
-                   $$->push_back(new string (""));
-                 }
+                 { $$ = make_tuple("corr", $3, $5, ""); }
                | CORR '(' symbol COMMA symbol ')' '.' symbol '.' OPTIONS
-                 {
-                   $$ = new vector<string *>();
-                   $$->push_back(new string ("corr"));
-                   $$->push_back($3);
-                   $$->push_back($5);
-                   $$->push_back($8);
-                 }
+                 { $$ = make_tuple("corr", $3, $5, $8); }
                ;
 
 estimation : ESTIMATION ';'
@@ -2134,30 +2023,15 @@ optim_options : list_optim_option
               ;
 
 list_sub_sampling_option : QUOTED_STRING COMMA QUOTED_STRING
-                           {
-                             $1->insert(0, "''");
-                             $1->append("'', ''");
-                             $1->append(*$3);
-                             $1->append("''");
-                             $$ = $1;
-                           }
+                           { $$ = "''" + $1 + "'', ''" + $3 + "''"; }
                          | QUOTED_STRING COMMA signed_number
-                           {
-                             $1->insert(0, "''");
-                             $1->append("'',");
-                             $1->append(*$3);
-                             $$ = $1;
-                           }
+                           { $$ = "''" + $1 + "''," + $3; }
                          ;
 
 sub_sampling_options : list_sub_sampling_option
                        { $$ = $1; }
                      | sub_sampling_options COMMA list_sub_sampling_option
-                       {
-                         $1->append(",");
-                         $1->append(*$3);
-                         $$ = $1;
-                       }
+                       { $$ = $1 + ',' + $3; }
                      ;
 
 list_sampling_option : QUOTED_STRING COMMA QUOTED_STRING
@@ -2165,11 +2039,7 @@ list_sampling_option : QUOTED_STRING COMMA QUOTED_STRING
                      | QUOTED_STRING COMMA signed_number
                        { driver.sampling_options_num($1, $3); }
                      | QUOTED_STRING COMMA '(' sub_sampling_options ')'
-                       {
-                         $4->insert(0,"(");
-                         $4->append(")");
-                         driver.sampling_options_string($1, $4);
-                       }
+                       { driver.sampling_options_string($1, '(' + $4 + ')'); }
                      ;
 
 sampling_options : list_sampling_option
@@ -2303,7 +2173,9 @@ model_comparison : MODEL_COMPARISON mc_filename_list ';'
                  ;
 
 filename : symbol
+           { $$ = $1; }
          | QUOTED_STRING
+           { $$ = $1; }
          ;
 
 parallel_local_filename_list : filename
@@ -2900,7 +2772,7 @@ homotopy_list : homotopy_item
 homotopy_item : symbol COMMA expression COMMA expression ';'
                 { driver.homotopy_val($1, $3, $5);}
               | symbol COMMA expression ';'
-                { driver.homotopy_val($1, NULL, $3);}
+                { driver.homotopy_val($1, nullptr, $3);}
               ;
 
 forecast: FORECAST ';' {driver.forecast();}
@@ -3049,29 +2921,13 @@ model_diagnostics : MODEL_DIAGNOSTICS ';'
                   ;
 
 calibration_range : '[' signed_number_w_inf signed_number_w_inf ']'
-                    {
-                      $$ = new vector<string *>();
-                      $$->push_back($2);
-                      $$->push_back($3);
-                    }
+                    { $$ = make_pair($2, $3); }
                   | '[' signed_number_w_inf COMMA signed_number_w_inf ']'
-                    {
-                      $$ = new vector<string *>();
-                      $$->push_back($2);
-                      $$->push_back($4);
-                    }
+                    { $$ = make_pair($2, $4); }
                   | PLUS
-                    {
-                      $$ = new vector<string *>();
-                      $$->push_back(new string("0"));
-                      $$->push_back(new string("inf"));
-                    }
+                    { $$ = make_pair("0", "inf"); }
                   | MINUS
-                    {
-                      $$ = new vector<string *>();
-                      $$->push_back(new string("-inf"));
-                      $$->push_back(new string("0"));
-                    }
+                    { $$ = make_pair("-inf", "0"); }
                   ;
 
 moment_calibration : MOMENT_CALIBRATION ';' moment_calibration_list END ';'
@@ -3083,7 +2939,7 @@ moment_calibration_list : moment_calibration_item
                         ;
 
 moment_calibration_item : symbol COMMA symbol COMMA calibration_range ';'
-                          { driver.add_moment_calibration_item($1, $3, new string("0"), $5); }
+                          { driver.add_moment_calibration_item($1, $3, "0", $5); }
                         | symbol COMMA symbol '(' signed_integer ')' COMMA calibration_range ';'
                           { driver.add_moment_calibration_item($1, $3, $5, $8); }
                         | symbol COMMA symbol '(' signed_integer_range ')' COMMA calibration_range ';'
@@ -3101,7 +2957,7 @@ irf_calibration_list : irf_calibration_item
                      ;
 
 irf_calibration_item : symbol COMMA symbol COMMA calibration_range ';'
-                       { driver.add_irf_calibration_item($1, new string("1"), $3, $5); }
+                       { driver.add_irf_calibration_item($1, "1", $3, $5); }
                      | symbol '(' INT_NUMBER ')' COMMA symbol COMMA calibration_range ';'
                        { driver.add_irf_calibration_item($1, $3, $6, $8); }
                      | symbol '(' integer_range ')' COMMA symbol COMMA calibration_range ';'
@@ -3125,7 +2981,8 @@ smoother2histval_option : o_infile
                         | o_outvars
                         ;
 
-shock_groups : SHOCK_GROUPS ';' shock_group_list END ';'{driver.end_shock_groups(new string("default"));}
+shock_groups : SHOCK_GROUPS ';' shock_group_list END ';'
+               { driver.end_shock_groups("default"); }
              | SHOCK_GROUPS '(' NAME EQUAL symbol ')' ';' shock_group_list END ';'
                {driver.end_shock_groups($5);}
              ;
@@ -3144,14 +3001,14 @@ shock_name_list : shock_name_list COMMA symbol {driver.add_shock_group_element($
                 ;
 
 o_dr_algo : DR_ALGO EQUAL INT_NUMBER {
-                                       if (*$3 == string("0"))
+                                       if ($3 == "0")
                                          driver.warning("dr_algo option is now deprecated, and may be removed in a future version of Dynare");
                                        else
                                          driver.error("dr_algo=1 option is no longer supported");
                                      };
 o_solve_algo : SOLVE_ALGO EQUAL INT_NUMBER { driver.option_num("solve_algo", $3); };
 o_simul_algo : SIMUL_ALGO EQUAL INT_NUMBER {
-                                             if (*$3 == string("0"))
+                                             if ($3 == "0")
                                                driver.warning("simul_algo option is now deprecated, and may be removed in a future version of Dynare");
                                              else
                                                driver.error("simul_algo=1 option is no longer supported");
@@ -3789,48 +3646,27 @@ o_emas_tolf : EMAS_TOLF EQUAL non_negative_number { driver.option_num("irf_opt.E
 o_emas_max_iter : EMAS_MAX_ITER EQUAL INT_NUMBER { driver.option_num("irf_opt.EM.iter", $3); };
 
 range : symbol ':' symbol
-        {
-          $1->append(":");
-          $1->append(*$3);
-          delete $3;
-          $$ = $1;
-        };
+        { $$ = $1 + ':' + $3; }
 
 integer_range : INT_NUMBER ':' INT_NUMBER
-                {
-                  $1->append(":");
-                  $1->append(*$3);
-                  delete $3;
-                  $$ = $1;
-                };
-        
+                { $$ = $1 + ':' + $3; }
+
 signed_integer_range : signed_integer ':' signed_integer
-                       {
-                         $1->append(":");
-                         $1->append(*$3);
-                         delete $3;
-                         $$ = $1;
-                       }
+                       { $$ = $1 + ':' + $3; }
                      | MINUS '(' signed_integer ':' signed_integer ')'
-                       {
-                         $3->insert(0, "-(");
-                         $3->append(":");
-                         $3->append(*$5);
-                         delete $5;
-                         $3->append(")");
-                         $$ = $3;
-                       };
+                       { $$ = "-(" + $3 + ':' + $5 + ")"; };
 
-vec_int_number : INT_NUMBER { $$ = new vector<int>(); $$->push_back(stoi(*$1)); delete $1; };
+vec_int_number : INT_NUMBER
+                 { $$ = vector<int>{stoi($1)}; }
+               ;
 
 vec_int_elem : vec_int_number
+               { $$ = $1; }
              | INT_NUMBER ':' INT_NUMBER
                {
-                 $$ = new vector<int>();
-                 for(int i=stoi(*$1); i<=stoi(*$3); i++)
-                   $$->push_back(i);
-                 delete $1;
-                 delete $3;
+                 $$ = vector<int>{};
+                 for (int i = stoi($1); i <= stoi($3); i++)
+                   $$.push_back(i);
                }
              ;
 
@@ -3841,18 +3677,12 @@ vec_int_1 : '[' vec_int_elem
           | vec_int_1 vec_int_elem
             {
               $$ = $1;
-              for (vector<int>::const_iterator it=$2->begin();
-                   it!=$2->end(); it++)
-                $1->push_back(*it);
-              delete $2;
+              $$.insert($$.end(), $2.begin(), $2.end());
             }
           | vec_int_1 COMMA vec_int_elem
             {
               $$ = $1;
-              for (vector<int>::const_iterator it=$3->begin();
-                   it!=$3->end(); it++)
-                $1->push_back(*it);
-              delete $3;
+              $$.insert($$.end(), $3.begin(), $3.end());
             }
           ;
 
@@ -3863,13 +3693,19 @@ vec_int : vec_int_1 ']'
         ;
 
 vec_str_1 : '[' QUOTED_STRING
-            { $$ = new vector<string>(); $$->push_back(*$2); delete $2; }
+            { $$ = vector<string>{$2}; }
           | '[' COMMA QUOTED_STRING
-            { $$ = new vector<string>(); $$->push_back(*$3); delete $3; }
+            { $$ = vector<string>{$3}; }
           | vec_str_1 QUOTED_STRING
-            { $$->push_back(*$2); delete $2; }
+            {
+              $$ = $1;
+              $$.push_back($2);
+            }
           | vec_str_1 COMMA QUOTED_STRING
-            { $$->push_back(*$3); delete $3; }
+            {
+              $$ = $1;
+              $$.push_back($3);
+            }
           ;
 
 vec_str : vec_str_1 ']'
@@ -3878,79 +3714,89 @@ vec_str : vec_str_1 ']'
           { $$ = $1; }
         ;
 
-vec_value_1 : '[' signed_number { $2->insert(0,"["); $$ = $2; }
-            | '[' COMMA signed_number { $3->insert(0,"["); $$ = $3; }
+vec_value_1 : '[' signed_number
+              { $$ = '[' + $2; }
+            | '[' COMMA signed_number
+              { $$ = '[' + $3; }
             | vec_value_1 signed_number
-              {
-                $1->append(" ");
-                $1->append(*$2);
-                delete $2;
-                $$ = $1;
-              }
+              { $$ = $1 + ' ' + $2; }
             | vec_value_1 COMMA signed_number
-              {
-                $1->append(" ");
-                $1->append(*$3);
-                delete $3;
-                $$ = $1;
-              }
+              { $$ = $1 + ' ' + $3; }
             ;
 
-vec_value : vec_value_1 ']' { $1->append("]"); $$ = $1; }
-          | vec_value_1 COMMA ']' { $1->append("]"); $$ = $1; }
+vec_value : vec_value_1 ']'
+             { $$ = $1 + ']'; }
+          | vec_value_1 COMMA ']'
+             { $$ = $1 + ']'; }
           ;
 
 vec_value_list : vec_value_list COMMA vec_value
-                 {
-                   $1->append(",");
-                   $1->append(*$3);
-                   delete $3;
-                   $$ = $1;
-                 }
+                 { $$ = $1 + ',' + $3; }
                | vec_value
                  { $$ = $1; }
                ;
 
-vec_of_vec_value : '[' vec_value_list ']' { $$ = $2; }
-                 | vec_value  { $$ = $1; };
+vec_of_vec_value : '[' vec_value_list ']'
+                   { $$ = $2; }
+                 | vec_value
+                   { $$ = $1; };
 
 vec_value_1_w_inf : '[' signed_number_w_inf
-                    { $2->insert(0, "["); $$ = $2;}
+                    { $$ = '[' + $2; }
                   | vec_value_1_w_inf signed_number_w_inf
-                    {
-                      $1->append(" ");
-                      $1->append(*$2);
-                      delete $2;
-                      $$ = $1;
-                    }
+                    { $$ = $1 + ' ' + $2; }
                   ;
 
-vec_value_w_inf : vec_value_1_w_inf ']' { $1->append("]"); $$ = $1; };
+vec_value_w_inf : vec_value_1_w_inf ']'
+                  { $$ = $1 + ']'; };
 
 symbol : NAME
+         { $$ = $1; }
        | ALPHA
+         { $$ = $1; }
        | BETA
+         { $$ = $1; }
        | NINV
+         { $$ = $1; }
        | ABAND
+         { $$ = $1; }
        | CMS
+         { $$ = $1; }
        | NCMS
+         { $$ = $1; }
        | CNUM
+         { $$ = $1; }
        | GAMMA
+         { $$ = $1; }
        | INV_GAMMA
+         { $$ = $1; }
        | INV_GAMMA1
+         { $$ = $1; }
        | INV_GAMMA2
+         { $$ = $1; }
        | NORMAL
+         { $$ = $1; }
        | UNIFORM
+         { $$ = $1; }
        | EPS
+         { $$ = $1; }
        | PDF
+         { $$ = $1; }
        | FIG
+         { $$ = $1; }
        | NONE
+         { $$ = $1; }
        | DR
+         { $$ = $1; }
        | PRIOR
+         { $$ = $1; }
        ;
 
+
 number : INT_NUMBER
+         { $$ = $1; }
        | FLOAT_NUMBER
+         { $$ = $1; }
        ;
 %%
 
diff --git a/src/DynareFlex.ll b/src/DynareFlex.ll
index 74527313dafd095a6179fb6ac31ea476c02d7daa..1b6cbf7c48f209398af5c7755cf184e6c399569e 100644
--- a/src/DynareFlex.ll
+++ b/src/DynareFlex.ll
@@ -226,7 +226,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
 <DYNARE_STATEMENT>subsamples {return token::SUBSAMPLES;}
 <DYNARE_STATEMENT>options {return token::OPTIONS;}
 <DYNARE_STATEMENT>prior {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::PRIOR;
 }
 <INITIAL>std {BEGIN DYNARE_STATEMENT; return token::STD;}
@@ -260,7 +260,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
                             *yyout << yytext + 1;
 #endif
                           }
-<DYNARE_STATEMENT>dates  {dates_parens_nb=0; BEGIN DATES_STATEMENT; yylval->string_val = new string("dates");}
+<DYNARE_STATEMENT>dates  {dates_parens_nb=0; BEGIN DATES_STATEMENT; yylval->build<string>("dates");}
 <DYNARE_STATEMENT>file                  {return token::FILE;}
 <DYNARE_STATEMENT>datafile 		{return token::DATAFILE;}
 <DYNARE_STATEMENT>dirname       {return token::DIRNAME;}
@@ -293,10 +293,10 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
 <DYNARE_STATEMENT>posterior_nograph   		{return token::POSTERIOR_NOGRAPH;}
 <DYNARE_STATEMENT>nodisplay     {return token::NODISPLAY;}
 <DYNARE_STATEMENT>graph_format  {return token::GRAPH_FORMAT;}
-<DYNARE_STATEMENT>eps  {yylval->string_val = new string(yytext); return token::EPS;}
-<DYNARE_STATEMENT>pdf  {yylval->string_val = new string(yytext); return token::PDF;}
-<DYNARE_STATEMENT>fig  {yylval->string_val = new string(yytext); return token::FIG;}
-<DYNARE_STATEMENT>none  {yylval->string_val = new string(yytext); return token::NONE;}
+<DYNARE_STATEMENT>eps  {yylval->build<string>(yytext); return token::EPS;}
+<DYNARE_STATEMENT>pdf  {yylval->build<string>(yytext); return token::PDF;}
+<DYNARE_STATEMENT>fig  {yylval->build<string>(yytext); return token::FIG;}
+<DYNARE_STATEMENT>none  {yylval->build<string>(yytext); return token::NONE;}
 <DYNARE_STATEMENT>print   		{return token::PRINT;}
 <DYNARE_STATEMENT>noprint   		{return token::NOPRINT;}
 <DYNARE_STATEMENT>conf_sig  		{return token::CONF_SIG;}
@@ -428,43 +428,43 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
 <DYNARE_STATEMENT>use_penalized_objective_for_hessian {return token::USE_PENALIZED_OBJECTIVE_FOR_HESSIAN;}
 
 <DYNARE_STATEMENT>alpha {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::ALPHA;
 }
 <DYNARE_STATEMENT>beta {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::BETA;
 }
 <DYNARE_STATEMENT>gamma {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::GAMMA;
 }
 <DYNARE_STATEMENT>inv_gamma {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::INV_GAMMA;
 }
 <DYNARE_STATEMENT>inv_gamma1 {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::INV_GAMMA1;
 }
 <DYNARE_STATEMENT>inv_gamma2 {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::INV_GAMMA2;
 }
 <DYNARE_STATEMENT>dirichlet {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::DIRICHLET;
 }
 <DYNARE_STATEMENT>weibull {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::WEIBULL;
 }
 <DYNARE_STATEMENT>normal {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::NORMAL;
 }
 <DYNARE_STATEMENT>uniform {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::UNIFORM;
 }
 <DYNARE_STATEMENT>gsig2_lmdm {return token::GSIG2_LMDM;}
@@ -475,13 +475,13 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
 <DYNARE_STATEMENT>ncsk {return token::NCSK;}
 <DYNARE_STATEMENT>nstd {return token::NSTD;}
 <DYNARE_STATEMENT>ninv {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::NINV;
 }
 <DYNARE_STATEMENT>indxparr {return token::INDXPARR;}
 <DYNARE_STATEMENT>indxovr {return token::INDXOVR;}
 <DYNARE_STATEMENT>aband {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::ABAND;
 }
 <DYNARE_STATEMENT>write_equation_tags {return token::WRITE_EQUATION_TAGS;}
@@ -498,18 +498,18 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
 <DYNARE_STATEMENT>indxgdls {return token::INDXGDLS;}
 <DYNARE_STATEMENT>eq_ms {return token::EQ_MS;}
 <DYNARE_STATEMENT>cms {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::CMS;
 }
 <DYNARE_STATEMENT>ncms {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::NCMS;
 }
 <DYNARE_STATEMENT>eq_cms {return token::EQ_CMS;}
 <DYNARE_STATEMENT>tlindx {return token::TLINDX;}
 <DYNARE_STATEMENT>tlnumber {return token::TLNUMBER;}
 <DYNARE_STATEMENT>cnum {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::CNUM;
 }
 <DYNARE_STATEMENT>nodecomposition {return token::NODECOMPOSITION;};
@@ -561,15 +561,15 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
 <DYNARE_STATEMENT>opt_algo {return token::OPT_ALGO;}
 <DYNARE_STATEMENT>instruments {return token::INSTRUMENTS;}
 <DYNARE_STATEMENT>hessian  {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::HESSIAN;
 }
 <DYNARE_STATEMENT>prior_variance  {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::PRIOR_VARIANCE;
 }
 <DYNARE_STATEMENT>identity_matrix  {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::IDENTITY_MATRIX;
 }
 <DYNARE_STATEMENT>mcmc_jumping_covariance {return token::MCMC_JUMPING_COVARIANCE;}
@@ -655,11 +655,11 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
 <DYNARE_STATEMENT>recursive_order_estimation {return token::RECURSIVE_ORDER_ESTIMATION; }
 <DYNARE_STATEMENT>bartlett_kernel_lag {return token::BARTLETT_KERNEL_LAG; }
 <DYNARE_STATEMENT>optimal {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::OPTIMAL;
 }
 <DYNARE_STATEMENT>diagonal  {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::DIAGONAL;
 }
 <DYNARE_STATEMENT>weighting_matrix {return token::WEIGHTING_MATRIX; }
@@ -677,7 +677,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
 
 <DYNARE_STATEMENT>[\$][^$]*[\$] {
   strtok(yytext+1, "$");
-  yylval->string_val = new string(yytext + 1);
+  yylval->build<string>(yytext + 1);
   return token::TEX_NAME;
 }
 
@@ -716,7 +716,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
 <DYNARE_STATEMENT>sylvester {return token::SYLVESTER;}
 <DYNARE_STATEMENT>lyapunov {return token::LYAPUNOV;}
 <DYNARE_STATEMENT>dr {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::DR;
  }
 <DYNARE_STATEMENT>sylvester_fixed_point_tol {return token::SYLVESTER_FIXED_POINT_TOL;}
@@ -883,38 +883,37 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
 <DYNARE_STATEMENT>colormap {return token::COLORMAP;}
 
 <DYNARE_STATEMENT,DYNARE_BLOCK>[A-Za-z_][A-Za-z0-9_]* {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::NAME;
 }
 
 <DYNARE_STATEMENT,DYNARE_BLOCK>((([0-9]*\.[0-9]+)|([0-9]+\.))([edED][-+]?[0-9]+)?)|([0-9]+[edED][-+]?[0-9]+) {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::FLOAT_NUMBER;
 }
 
 <DYNARE_STATEMENT,DYNARE_BLOCK>[0-9]+ {
-  yylval->string_val = new string(yytext);
+  yylval->build<string>(yytext);
   return token::INT_NUMBER;
 }
 
-<DATES_STATEMENT>\( { yylval->string_val->append(yytext); dates_parens_nb++; }
+<DATES_STATEMENT>\( { yylval->as<string>().append(yytext); dates_parens_nb++; }
 <DATES_STATEMENT>\) {
-                      yylval->string_val->append(yytext);
+                      yylval->as<string>().append(yytext);
                       if (--dates_parens_nb == 0)
                       {
                         BEGIN DYNARE_STATEMENT;
                         return token::DATES;
                       }
                     }
-<DATES_STATEMENT>.  { yylval->string_val->append(yytext); }
+<DATES_STATEMENT>.  { yylval->as<string>().append(yytext); }
 
 <DYNARE_BLOCK>\|[eE] { return token::PIPE_E; }
 <DYNARE_BLOCK>\|[xX] { return token::PIPE_X; }
 <DYNARE_BLOCK>\|[pP] { return token::PIPE_P; }
 
 <DYNARE_STATEMENT,DYNARE_BLOCK>\'[^\']+\' {
-  yylval->string_val = new string(yytext + 1);
-  yylval->string_val->resize(yylval->string_val->length() - 1);
+  yylval->build<string>(yytext + 1).pop_back();
   return token::QUOTED_STRING;
 }
 
@@ -922,11 +921,9 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
  /* Verbatim Block */
 <INITIAL>verbatim[[:space:]]*;   {
                                    BEGIN VERBATIM_BLOCK;
-                                   yylval->string_val = new string();
                                  }
 <VERBATIM_BLOCK>end[[:space:]]*; {
                                    BEGIN INITIAL;
-                                   yylval->string_val = new string();
                                  }
 <VERBATIM_BLOCK>\n      {
                           if (strlen(yytext) > 1)
@@ -952,7 +949,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
   if (driver.symbol_exists_and_is_not_modfile_local_or_external_function(yytext))
     {
       BEGIN DYNARE_STATEMENT;
-      yylval->string_val = new string(yytext);
+      yylval->build<string>(yytext);
       return token::NAME;
     }
   else
@@ -973,20 +970,15 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
   yytextcpy.erase(remove(yytextcpy.begin(), yytextcpy.end(), ' '), yytextcpy.end());
   istringstream ss(yytextcpy);
   string token;
-  yylval->vector_string_val = new vector<string>;
-  yylval->vector_string_p_val = new vector<string *>;
+  vector<string> val;
 
   bool dynare_statement = true;
 
   while(getline(ss, token, ','))
-    if (driver.symbol_exists_and_is_not_modfile_local_or_external_function(token.c_str()))
-      yylval->vector_string_p_val->push_back(new string(token));
+    if (driver.symbol_exists_and_is_not_modfile_local_or_external_function(token))
+      val.push_back(token);
     else
       {
-        for (vector<string *>::iterator it=yylval->vector_string_p_val->begin();
-            it != yylval->vector_string_p_val->end(); it++)
-          delete *it;
-        delete yylval->vector_string_p_val;
         BEGIN NATIVE;
         yyless(0);
         dynare_statement = false;
@@ -995,6 +987,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
   if (dynare_statement)
     {
       BEGIN DYNARE_STATEMENT;
+      yylval->build<vector<string>>(val);
       return token::SYMBOL_VEC;
     }
 }
diff --git a/src/ParsingDriver.cc b/src/ParsingDriver.cc
index 4500c15c7fd7b67141d504bfd4b924e1e0b4aa67..908b8e28255e767857bc2e936ab6e86bbd7e81c7 100644
--- a/src/ParsingDriver.cc
+++ b/src/ParsingDriver.cc
@@ -29,7 +29,7 @@
 #include "WarningConsolidation.hh"
 
 bool
-ParsingDriver::symbol_exists_and_is_not_modfile_local_or_external_function(const char *s)
+ParsingDriver::symbol_exists_and_is_not_modfile_local_or_external_function(const string &s)
 {
   if (!mod_file->symbol_table.exists(s))
     return false;
@@ -55,12 +55,12 @@ ParsingDriver::check_symbol_existence(const string &name)
 }
 
 void
-ParsingDriver::check_symbol_is_parameter(string *name)
+ParsingDriver::check_symbol_is_parameter(const string &name)
 {
-  check_symbol_existence(*name);
-  int symb_id = mod_file->symbol_table.getID(*name);
+  check_symbol_existence(name);
+  int symb_id = mod_file->symbol_table.getID(name);
   if (mod_file->symbol_table.getType(symb_id) != SymbolType::parameter)
-    error(*name + " is not a parameter");
+    error(name + " is not a parameter");
 }
 
 void
@@ -182,139 +182,76 @@ ParsingDriver::warning(const string &m)
 }
 
 void
-ParsingDriver::declare_symbol(const string *name, SymbolType type, const string *tex_name, const vector<pair<string *, string *> *> *partition_value)
+ParsingDriver::declare_symbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string, string>> &partition_value)
 {
   try
     {
-      if (tex_name == nullptr && partition_value == nullptr)
-        mod_file->symbol_table.addSymbol(*name, type);
-      else
-        if (tex_name == nullptr)
-          mod_file->symbol_table.addSymbol(*name, type, "", partition_value);
-        else if (partition_value == nullptr)
-          mod_file->symbol_table.addSymbol(*name, type, *tex_name, nullptr);
-        else
-          mod_file->symbol_table.addSymbol(*name, type, *tex_name, partition_value);
+      mod_file->symbol_table.addSymbol(name, type, tex_name, partition_value);
     }
   catch (SymbolTable::AlreadyDeclaredException &e)
     {
       if (e.same_type)
-        warning("Symbol " + *name + " declared twice.");
+        warning("Symbol " + name + " declared twice.");
       else
-        error("Symbol " + *name + " declared twice with different types!");
+        error("Symbol " + name + " declared twice with different types!");
     }
 }
 
 void
-ParsingDriver::declare_endogenous(string *name, string *tex_name, vector<pair<string *, string *> *> *partition_value)
+ParsingDriver::declare_endogenous(const string &name, const string &tex_name, const vector<pair<string, string>> &partition_value)
 {
   declare_symbol(name, SymbolType::endogenous, tex_name, partition_value);
-  delete name;
-  if (tex_name != nullptr)
-    delete tex_name;
-  if (partition_value != nullptr)
-    {
-      for (auto & it : *partition_value)
-        {
-          delete it->first;
-          delete it->second;
-          delete it;
-        }
-      delete partition_value;
-    }
 }
 
 void
-ParsingDriver::declare_var_endogenous(string *name)
+ParsingDriver::declare_var_endogenous(const string &name)
 {
-  if (mod_file->symbol_table.exists(*name))
+  if (mod_file->symbol_table.exists(name))
     {
-      SymbolType type = mod_file->symbol_table.getType(*name);
+      SymbolType type = mod_file->symbol_table.getType(name);
       if (type != SymbolType::endogenous && type != SymbolType::exogenous && type != SymbolType::exogenousDet)
-        error("Symbol " + *name + " used in a VAR must be either endogenous or "
+        error("Symbol " + name + " used in a VAR must be either endogenous or "
               +"exogenous if it is also used elsewhere in the .mod file");
       add_in_symbol_list(name);
       return;
     }
 
-  declare_symbol(name, SymbolType::endogenousVAR, nullptr, nullptr);
+  declare_symbol(name, SymbolType::endogenousVAR, "", {});
   add_in_symbol_list(name);
 }
 
 void
-ParsingDriver::declare_exogenous(string *name, string *tex_name, vector<pair<string *, string *> *> *partition_value)
+ParsingDriver::declare_exogenous(const string &name, const string &tex_name, const vector<pair<string, string>> &partition_value)
 {
   declare_symbol(name, SymbolType::exogenous, tex_name, partition_value);
-  delete name;
-  if (tex_name != nullptr)
-    delete tex_name;
-  if (partition_value != nullptr)
-    {
-      for (auto & it : *partition_value)
-        {
-          delete it->first;
-          delete it->second;
-          delete it;
-        }
-      delete partition_value;
-    }
 }
 
 void
-ParsingDriver::declare_exogenous_det(string *name, string *tex_name, vector<pair<string *, string *> *> *partition_value)
+ParsingDriver::declare_exogenous_det(const string &name, const string &tex_name, const vector<pair<string, string>> &partition_value)
 {
   declare_symbol(name, SymbolType::exogenousDet, tex_name, partition_value);
-  delete name;
-  if (tex_name != nullptr)
-    delete tex_name;
-  if (partition_value != nullptr)
-    {
-      for (auto & it : *partition_value)
-        {
-          delete it->first;
-          delete it->second;
-          delete it;
-        }
-      delete partition_value;
-    }
 }
 
 void
-ParsingDriver::declare_parameter(string *name, string *tex_name, vector<pair<string *, string *> *> *partition_value)
+ParsingDriver::declare_parameter(const string &name, const string &tex_name, const vector<pair<string, string>> &partition_value)
 {
   declare_symbol(name, SymbolType::parameter, tex_name, partition_value);
-  delete name;
-  if (tex_name != nullptr)
-    delete tex_name;
-  if (partition_value != nullptr)
-    {
-      for (auto & it : *partition_value)
-        {
-          delete it->first;
-          delete it->second;
-          delete it;
-        }
-      delete partition_value;
-    }
 }
 
 void
-ParsingDriver::declare_statement_local_variable(string *name)
+ParsingDriver::declare_statement_local_variable(const string &name)
 {
-  if (mod_file->symbol_table.exists(*name))
-    error("Symbol " + *name + " cannot be assigned within a statement "
+  if (mod_file->symbol_table.exists(name))
+    error("Symbol " + name + " cannot be assigned within a statement "
           +"while being assigned elsewhere in the modfile");
-  declare_symbol(name, SymbolType::statementDeclaredVariable, nullptr, nullptr);
-  delete name;
+  declare_symbol(name, SymbolType::statementDeclaredVariable, "", {});
 }
 
 void
 ParsingDriver::declare_optimal_policy_discount_factor_parameter(expr_t exprnode)
 {
-  string *optimalParName_declare = new string("optimal_policy_discount_factor");
-  string *optimalParName_init = new string("optimal_policy_discount_factor");
-  declare_parameter(optimalParName_declare, nullptr);
-  init_param(optimalParName_init, exprnode);
+  declare_parameter("optimal_policy_discount_factor");
+  init_param("optimal_policy_discount_factor", exprnode);
 }
 
 void
@@ -324,13 +261,10 @@ ParsingDriver::begin_trend()
 }
 
 void
-ParsingDriver::declare_trend_var(bool log_trend, string *name, string *tex_name)
+ParsingDriver::declare_trend_var(bool log_trend, const string &name, const string &tex_name)
 {
-  declare_symbol(name, log_trend ? SymbolType::logTrend : SymbolType::trend, tex_name, nullptr);
-  declared_trend_vars.push_back(mod_file->symbol_table.getID(*name));
-  delete name;
-  if (tex_name != nullptr)
-    delete tex_name;
+  declare_symbol(name, log_trend ? SymbolType::logTrend : SymbolType::trend, tex_name, {});
+  declared_trend_vars.push_back(mod_file->symbol_table.getID(name));
 }
 
 void
@@ -349,11 +283,11 @@ ParsingDriver::end_trend_var(expr_t growth_factor)
 }
 
 void
-ParsingDriver::add_predetermined_variable(string *name)
+ParsingDriver::add_predetermined_variable(const string &name)
 {
   try
     {
-      int symb_id = mod_file->symbol_table.getID(*name);
+      int symb_id = mod_file->symbol_table.getID(name);
       if (mod_file->symbol_table.getType(symb_id) != SymbolType::endogenous)
         error("Predetermined variables must be endogenous variables");
 
@@ -361,32 +295,24 @@ ParsingDriver::add_predetermined_variable(string *name)
     }
   catch (SymbolTable::UnknownSymbolNameException &e)
     {
-      error("Undeclared symbol name: " + *name);
+      error("Undeclared symbol name: " + name);
     }
-  delete name;
 }
 
 void
-ParsingDriver::add_equation_tags(string *key, string *value)
+ParsingDriver::add_equation_tags(string key, string value)
 {
-  eq_tags.emplace_back(*key, *value);
+  eq_tags.emplace_back(key, value);
 
-  transform(key->begin(), key->end(), key->begin(), ::tolower);
-  if (key->compare("endogenous") == 0)
+  transform(key.begin(), key.end(), key.begin(), ::tolower);
+  if (key.compare("endogenous") == 0)
     declare_or_change_type(SymbolType::endogenous, value);
-
-  if (!(key->compare("endogenous") == 0))
-    delete value;
-
-  delete key;
 }
 
 expr_t
-ParsingDriver::add_non_negative_constant(string *constant)
+ParsingDriver::add_non_negative_constant(const string &constant)
 {
-  expr_t id = data_tree->AddNonNegativeConstant(*constant);
-  delete constant;
-  return id;
+  return data_tree->AddNonNegativeConstant(constant);
 }
 
 expr_t
@@ -402,33 +328,32 @@ ParsingDriver::add_inf_constant()
 }
 
 expr_t
-ParsingDriver::add_model_variable(string *name)
+ParsingDriver::add_model_variable(const string &name)
 {
-  check_symbol_existence_in_model_block(*name);
+  check_symbol_existence_in_model_block(name);
   int symb_id;
   try
     {
-      symb_id = mod_file->symbol_table.getID(*name);
+      symb_id = mod_file->symbol_table.getID(name);
     }
   catch (SymbolTable::UnknownSymbolNameException &e)
     {
       // Declare variable as exogenous to continue parsing
       // processing will end at end of model block if nostrict option was not passed
-      declare_exogenous(new string(*name));
-      undeclared_model_vars.insert(*name);
-      symb_id = mod_file->symbol_table.getID(*name);
+      declare_exogenous(name);
+      undeclared_model_vars.insert(name);
+      symb_id = mod_file->symbol_table.getID(name);
     }
-  delete name;
   return add_model_variable(symb_id, 0);
 }
 
 expr_t
-ParsingDriver::declare_or_change_type(SymbolType new_type, string *name)
+ParsingDriver::declare_or_change_type(SymbolType new_type, const string &name)
 {
   int symb_id;
   try
     {
-      symb_id = mod_file->symbol_table.getID(*name);
+      symb_id = mod_file->symbol_table.getID(name);
       mod_file->symbol_table.changeType(symb_id, new_type);
 
       // change in equations in ModelTree
@@ -439,10 +364,10 @@ ParsingDriver::declare_or_change_type(SymbolType new_type, string *name)
       delete dm;
 
       // remove error messages
-      undeclared_model_vars.erase(*name);
+      undeclared_model_vars.erase(name);
       for (auto it = undeclared_model_variable_errors.begin();
            it != undeclared_model_variable_errors.end();)
-        if (it->first == *name)
+        if (it->first == name)
           it = undeclared_model_variable_errors.erase(it);
         else
           it++;
@@ -452,20 +377,19 @@ ParsingDriver::declare_or_change_type(SymbolType new_type, string *name)
       switch (new_type)
         {
         case SymbolType::endogenous:
-          declare_endogenous(new string(*name));
+          declare_endogenous(name);
           break;
         case SymbolType::exogenous:
-          declare_exogenous(new string(*name));
+          declare_exogenous(name);
           break;
         case SymbolType::parameter:
-          declare_parameter(new string(*name));
+          declare_parameter(name);
           break;
         default:
           error("Type not yet supported");
         }
-      symb_id = mod_file->symbol_table.getID(*name);
+      symb_id = mod_file->symbol_table.getID(name);
     }
-  delete name;
   return add_model_variable(symb_id, 0);
 
 }
@@ -498,46 +422,34 @@ ParsingDriver::add_model_variable(int symb_id, int lag)
 }
 
 expr_t
-ParsingDriver::add_expression_variable(string *name)
+ParsingDriver::add_expression_variable(const string &name)
 {
   // If symbol doesn't exist, then declare it as a mod file local variable
-  if (!mod_file->symbol_table.exists(*name))
-    mod_file->symbol_table.addSymbol(*name, SymbolType::modFileLocalVariable);
+  if (!mod_file->symbol_table.exists(name))
+    mod_file->symbol_table.addSymbol(name, SymbolType::modFileLocalVariable);
 
   // This check must come after the previous one!
-  if (mod_file->symbol_table.getType(*name) == SymbolType::modelLocalVariable)
-    error("Variable " + *name + " not allowed outside model declaration. Its scope is only inside model.");
-
-  if (mod_file->symbol_table.getType(*name) == SymbolType::trend
-      || mod_file->symbol_table.getType(*name) == SymbolType::logTrend)
-    error("Variable " + *name + " not allowed outside model declaration, because it is a trend variable.");
+  if (mod_file->symbol_table.getType(name) == SymbolType::modelLocalVariable)
+    error("Variable " + name + " not allowed outside model declaration. Its scope is only inside model.");
 
-  if (mod_file->symbol_table.getType(*name) == SymbolType::externalFunction)
-    error("Symbol '" + *name + "' is the name of a MATLAB/Octave function, and cannot be used as a variable.");
+  if (mod_file->symbol_table.getType(name) == SymbolType::trend
+      || mod_file->symbol_table.getType(name) == SymbolType::logTrend)
+    error("Variable " + name + " not allowed outside model declaration, because it is a trend variable.");
 
-  int symb_id = mod_file->symbol_table.getID(*name);
-  expr_t id = data_tree->AddVariable(symb_id);
+  if (mod_file->symbol_table.getType(name) == SymbolType::externalFunction)
+    error("Symbol '" + name + "' is the name of a MATLAB/Octave function, and cannot be used as a variable.");
 
-  delete name;
-  return id;
+  int symb_id = mod_file->symbol_table.getID(name);
+  return data_tree->AddVariable(symb_id);
 }
 
 void
-ParsingDriver::declare_nonstationary_var(string *name, string *tex_name, vector<pair<string *, string *> *> *partition_value)
+ParsingDriver::declare_nonstationary_var(const string &name, const string &tex_name, const vector<pair<string, string>> &partition_value)
 {
-  if (tex_name == nullptr && partition_value == nullptr)
-    declare_endogenous(new string(*name));
-  else
-    if (tex_name == nullptr)
-      declare_endogenous(new string(*name), nullptr, partition_value);
-    else if (partition_value == nullptr)
-      declare_endogenous(new string(*name), tex_name);
-    else
-      declare_endogenous(new string(*name), tex_name, partition_value);
+  declare_endogenous(name, tex_name, partition_value);
 
-  declared_nonstationary_vars.push_back(mod_file->symbol_table.getID(*name));
+  declared_nonstationary_vars.push_back(mod_file->symbol_table.getID(name));
   mod_file->nonstationary_variables = true;
-  delete name;
 }
 
 void
@@ -569,9 +481,9 @@ ParsingDriver::begin_VAR_restrictions()
 }
 
 void
-ParsingDriver::end_VAR_restrictions(string *var_model_name)
+ParsingDriver::end_VAR_restrictions(const string &var_model_name)
 {
-  mod_file->addStatement(new VarRestrictionsStatement(*var_model_name,
+  mod_file->addStatement(new VarRestrictionsStatement(var_model_name,
                                                       var_map,
                                                       exclusion_restrictions,
                                                       equation_restrictions,
@@ -596,9 +508,9 @@ ParsingDriver::clear_VAR_storage()
 }
 
 void
-ParsingDriver::add_VAR_exclusion_restriction(string *lagstr)
+ParsingDriver::add_VAR_exclusion_restriction(const string &lagstr)
 {
-  int lag = stoi(*lagstr);
+  int lag = stoi(lagstr);
   auto it = exclusion_restrictions.find(lag);
   if (it == exclusion_restrictions.end())
     exclusion_restrictions[lag] = exclusion_restriction;
@@ -608,22 +520,16 @@ ParsingDriver::add_VAR_exclusion_restriction(string *lagstr)
       it->second[it1->first] = it1->second;
 
   exclusion_restriction.clear();
-  delete lagstr;
 }
 
 void
-ParsingDriver::add_VAR_restriction_coeff(string *name1, string *name2, string *lagstr)
+ParsingDriver::add_VAR_restriction_coeff(const string &name1, const string &name2, const string &lagstr)
 {
-  int symb_id1 = mod_file->symbol_table.getID(*name1);
-  int symb_id2 = name2 == nullptr ? -1 : mod_file->symbol_table.getID(*name2);
-  int lag = stoi(*lagstr);
+  int symb_id1 = mod_file->symbol_table.getID(name1);
+  int symb_id2 = name2.empty() ? -1 : mod_file->symbol_table.getID(name2);
+  int lag = stoi(lagstr);
 
   var_restriction_coeff = { symb_id1, { symb_id2, lag } };
-
-  delete name1;
-  if (name2 != nullptr)
-    delete name2;
-  delete lagstr;
 }
 
 void
@@ -633,10 +539,10 @@ ParsingDriver::add_VAR_restriction_eq_or_crosseq(expr_t expr)
 }
 
 void
-ParsingDriver::add_VAR_restriction_equation_or_crossequation(string *numberstr)
+ParsingDriver::add_VAR_restriction_equation_or_crossequation(const string &numberstr)
 {
   assert(var_restriction_eq_or_crosseq.size() > 0 && var_restriction_eq_or_crosseq.size() < 3);
-  double number = stod(*numberstr);
+  double number = stod(numberstr);
   if (var_restriction_eq_or_crosseq.size() == 1)
     var_restriction_equation_or_crossequation = { { var_restriction_eq_or_crosseq[0], { { -1, { -1, -1 } }, nullptr } }, number };
   else
@@ -649,56 +555,47 @@ ParsingDriver::multiply_arg2_by_neg_one()
 {
   assert(var_restriction_eq_or_crosseq.size() == 2);
   expr_t exprtm1 = add_times(var_restriction_eq_or_crosseq[1].second,
-                             add_uminus(add_non_negative_constant(new string("-1"))));
+                             add_uminus(add_non_negative_constant("-1")));
   var_restriction_eq_or_crosseq[1] = { var_restriction_eq_or_crosseq[1].first, exprtm1 };
 }
 
 void
-ParsingDriver::add_VAR_restriction_equation_or_crossequation_final(string *name)
+ParsingDriver::add_VAR_restriction_equation_or_crossequation_final(const string &name)
 {
-  if (name != nullptr)
+  if (!name.empty())
     {
-      int symb_id = mod_file->symbol_table.getID(*name);
+      int symb_id = mod_file->symbol_table.getID(name);
       equation_restrictions[symb_id] = var_restriction_equation_or_crossequation;
-      delete name;
     }
   else
     crossequation_restrictions.push_back(var_restriction_equation_or_crossequation);
 }
 
 void
-ParsingDriver::add_VAR_restriction_exclusion_equation(string *name)
+ParsingDriver::add_VAR_restriction_exclusion_equation(const string &name)
 {
-  int symb_id = mod_file->symbol_table.getID(*name);
+  int symb_id = mod_file->symbol_table.getID(name);
   exclusion_restriction[symb_id] = symbol_list;
   symbol_list.clear();
-  delete name;
 }
 
 void
-ParsingDriver::add_VAR_covariance_number_restriction(string *name1, string *name2, string *valuestr)
+ParsingDriver::add_VAR_covariance_number_restriction(const string &name1, const string &name2, const string &valuestr)
 {
-  int symb_id1 = mod_file->symbol_table.getID(*name1);
-  int symb_id2 = mod_file->symbol_table.getID(*name2);
-  double value = stod(*valuestr);
+  int symb_id1 = mod_file->symbol_table.getID(name1);
+  int symb_id2 = mod_file->symbol_table.getID(name2);
+  double value = stod(valuestr);
   covariance_number_restriction[{ symb_id1, symb_id2 }] = value;
-  delete name1;
-  delete name2;
-  delete valuestr;
 }
 
 void
-ParsingDriver::add_VAR_covariance_pair_restriction(string *name11, string *name12, string *name21, string *name22)
+ParsingDriver::add_VAR_covariance_pair_restriction(const string &name11, const string &name12, const string &name21, const string &name22)
 {
-  int symb_id11 = mod_file->symbol_table.getID(*name11);
-  int symb_id12 = mod_file->symbol_table.getID(*name12);
-  int symb_id21 = mod_file->symbol_table.getID(*name21);
-  int symb_id22 = mod_file->symbol_table.getID(*name22);
+  int symb_id11 = mod_file->symbol_table.getID(name11);
+  int symb_id12 = mod_file->symbol_table.getID(name12);
+  int symb_id21 = mod_file->symbol_table.getID(name21);
+  int symb_id22 = mod_file->symbol_table.getID(name22);
   covariance_pair_restriction[{ symb_id11, symb_id12 }] = { symb_id21, symb_id22 };
-  delete name11;
-  delete name12;
-  delete name21;
-  delete name22;
 }
 
 void
@@ -708,97 +605,87 @@ ParsingDriver::run_var_estimation()
 }
 
 void
-ParsingDriver::periods(string *periods)
+ParsingDriver::periods(const string &periods)
 {
   warning("periods: this command is now deprecated and may be removed in a future version of Dynare. Please use the ''periods'' option of the ''simul'' command instead.");
 
-  int periods_val = stoi(*periods);
+  int periods_val = stoi(periods);
   mod_file->addStatement(new PeriodsStatement(periods_val));
-  delete periods;
 }
 
 void
-ParsingDriver::dsample(string *arg1)
+ParsingDriver::dsample(const string &arg1)
 {
-  int arg1_val = stoi(*arg1);
+  int arg1_val = stoi(arg1);
   mod_file->addStatement(new DsampleStatement(arg1_val));
-  delete arg1;
 }
 
 void
-ParsingDriver::dsample(string *arg1, string *arg2)
+ParsingDriver::dsample(const string &arg1, const string &arg2)
 {
-  int arg1_val = stoi(*arg1);
-  int arg2_val = stoi(*arg2);
+  int arg1_val = stoi(arg1);
+  int arg2_val = stoi(arg2);
   mod_file->addStatement(new DsampleStatement(arg1_val, arg2_val));
-  delete arg1;
-  delete arg2;
 }
 
 void
-ParsingDriver::init_param(string *name, expr_t rhs)
+ParsingDriver::init_param(const string &name, expr_t rhs)
 {
   check_symbol_is_parameter(name);
-  int symb_id = mod_file->symbol_table.getID(*name);
+  int symb_id = mod_file->symbol_table.getID(name);
   mod_file->addStatement(new InitParamStatement(symb_id, rhs, mod_file->symbol_table));
-  delete name;
 }
 
 void
-ParsingDriver::init_val(string *name, expr_t rhs)
+ParsingDriver::init_val(const string &name, expr_t rhs)
 {
   if (nostrict)
-    if (!mod_file->symbol_table.exists(*name))
+    if (!mod_file->symbol_table.exists(name))
       {
-        warning("discarding '" + *name + "' as it was not recognized in the initval or endval statement");
-        delete name;
+        warning("discarding '" + name + "' as it was not recognized in the initval or endval statement");
         return;
       }
 
-  check_symbol_existence(*name);
-  int symb_id = mod_file->symbol_table.getID(*name);
+  check_symbol_existence(name);
+  int symb_id = mod_file->symbol_table.getID(name);
   SymbolType type = mod_file->symbol_table.getType(symb_id);
 
   if (type != SymbolType::endogenous
       && type != SymbolType::exogenous
       && type != SymbolType::exogenousDet)
-    error("initval/endval: " + *name + " should be an endogenous or exogenous variable");
+    error("initval/endval: " + name + " should be an endogenous or exogenous variable");
 
   init_values.emplace_back(symb_id, rhs);
-
-  delete name;
 }
 
 void
-ParsingDriver::initval_file(string *filename)
+ParsingDriver::initval_file(const string &filename)
 {
-  mod_file->addStatement(new InitvalFileStatement(*filename));
-  delete filename;
+  mod_file->addStatement(new InitvalFileStatement(filename));
 }
 
 void
-ParsingDriver::hist_val(string *name, string *lag, expr_t rhs)
+ParsingDriver::hist_val(const string &name, const string &lag, expr_t rhs)
 {
   if (nostrict)
-    if (!mod_file->symbol_table.exists(*name))
+    if (!mod_file->symbol_table.exists(name))
       {
-        warning("discarding '" + *name + "' as it was not recognized in the histavl block");
-        delete name;
+        warning("discarding '" + name + "' as it was not recognized in the histavl block");
         return;
       }
 
-  check_symbol_existence(*name);
-  int symb_id = mod_file->symbol_table.getID(*name);
+  check_symbol_existence(name);
+  int symb_id = mod_file->symbol_table.getID(name);
   SymbolType type = mod_file->symbol_table.getType(symb_id);
 
   if (type != SymbolType::endogenous
       && type != SymbolType::exogenous
       && type != SymbolType::exogenousDet)
-    error("histval: " + *name + " should be an endogenous or exogenous variable");
+    error("histval: " + name + " should be an endogenous or exogenous variable");
 
-  int ilag = stoi(*lag);
+  int ilag = stoi(lag);
   if (ilag > 0)
-    error("histval: the lag on " + *name + " should be less than or equal to 0");
+    error("histval: the lag on " + name + " should be less than or equal to 0");
 
   pair<int, int> key(symb_id, ilag);
 
@@ -806,29 +693,24 @@ ParsingDriver::hist_val(string *name, string *lag, expr_t rhs)
     hist_vals_wrong_lag[symb_id] = ilag;
 
   if (hist_values.find(key) != hist_values.end())
-    error("hist_val: (" + *name + ", " + *lag + ") declared twice");
+    error("hist_val: (" + name + ", " + lag + ") declared twice");
 
   hist_values[key] = rhs;
-
-  delete name;
-  delete lag;
 }
 
 void
-ParsingDriver::homotopy_val(string *name, expr_t val1, expr_t val2)
+ParsingDriver::homotopy_val(const string &name, expr_t val1, expr_t val2)
 {
-  check_symbol_existence(*name);
-  int symb_id = mod_file->symbol_table.getID(*name);
+  check_symbol_existence(name);
+  int symb_id = mod_file->symbol_table.getID(name);
   SymbolType type = mod_file->symbol_table.getType(symb_id);
 
   if (type != SymbolType::parameter
       && type != SymbolType::exogenous
       && type != SymbolType::exogenousDet)
-    error("homotopy_val: " + *name + " should be a parameter or exogenous variable");
+    error("homotopy_val: " + name + " should be a parameter or exogenous variable");
 
   homotopy_values.emplace_back(symb_id, make_pair(val1, val2));
-
-  delete name;
 }
 
 void
@@ -842,33 +724,27 @@ ParsingDriver::end_generate_irfs()
 }
 
 void
-ParsingDriver::add_generate_irfs_element(string *name)
+ParsingDriver::add_generate_irfs_element(string name)
 {
-  for (vector<string>::const_iterator it = generate_irf_names.begin();
-       it != generate_irf_names.end(); it++)
-    if (*it == *name)
+  for (const auto &it : generate_irf_names)
+    if (it == name)
       error("Names in the generate_irfs block must be unique but you entered '"
-            + *name + "' more than once.");
+            + name + "' more than once.");
 
-  generate_irf_names.push_back(*name);
+  generate_irf_names.push_back(move(name));
   generate_irf_elements.push_back(generate_irf_exos);
 
   generate_irf_exos.clear();
-
-  delete name;
 }
 
 void
-ParsingDriver::add_generate_irfs_exog_element(string *exo, string *value)
+ParsingDriver::add_generate_irfs_exog_element(string exo, const string &value)
 {
   check_symbol_is_exogenous(exo);
-  if (generate_irf_exos.find(*exo) != generate_irf_exos.end())
-    error("You have set the exogenous variable " + *exo + " twice.");
+  if (generate_irf_exos.find(exo) != generate_irf_exos.end())
+    error("You have set the exogenous variable " + exo + " twice.");
 
-  generate_irf_exos[*exo] = stod(*value);
-
-  delete exo;
-  delete value;
+  generate_irf_exos[move(exo)] = stod(value);
 }
 
 void
@@ -925,21 +801,19 @@ ParsingDriver::differentiate_forward_vars_some()
 }
 
 void
-ParsingDriver::cutoff(string *value)
+ParsingDriver::cutoff(const string &value)
 {
-  double val = stod(*value);
+  double val = stod(value);
   mod_file->dynamic_model.cutoff = val;
   mod_file->static_model.cutoff = val;
-  delete value;
 }
 
 void
-ParsingDriver::mfs(string *value)
+ParsingDriver::mfs(const string &value)
 {
-  int val = stoi(*value);
+  int val = stoi(value);
   mod_file->dynamic_model.mfs = val;
   mod_file->static_model.mfs = val;
-  delete value;
 }
 
 void
@@ -1026,10 +900,10 @@ ParsingDriver::end_mshocks(bool overwrite)
 }
 
 void
-ParsingDriver::add_det_shock(string *var, bool conditional_forecast)
+ParsingDriver::add_det_shock(const string &var, bool conditional_forecast)
 {
-  check_symbol_existence(*var);
-  int symb_id = mod_file->symbol_table.getID(*var);
+  check_symbol_existence(var);
+  int symb_id = mod_file->symbol_table.getID(var);
   SymbolType type = mod_file->symbol_table.getType(symb_id);
 
   if (conditional_forecast)
@@ -1044,10 +918,10 @@ ParsingDriver::add_det_shock(string *var, bool conditional_forecast)
     }
 
   if (det_shocks.find(symb_id) != det_shocks.end())
-    error("shocks/conditional_forecast_paths: variable " + *var + " declared twice");
+    error("shocks/conditional_forecast_paths: variable " + var + " declared twice");
 
   if (det_shocks_periods.size() != det_shocks_values.size())
-    error("shocks/conditional_forecast_paths: variable " + *var + ": number of periods is different from number of shock values");
+    error("shocks/conditional_forecast_paths: variable " + var + ": number of periods is different from number of shock values");
 
   vector<ShocksStatement::DetShockElement> v;
 
@@ -1064,71 +938,62 @@ ParsingDriver::add_det_shock(string *var, bool conditional_forecast)
 
   det_shocks_periods.clear();
   det_shocks_values.clear();
-  delete var;
 }
 
 void
-ParsingDriver::add_stderr_shock(string *var, expr_t value)
+ParsingDriver::add_stderr_shock(const string &var, expr_t value)
 {
   if (nostrict)
-    if (!mod_file->symbol_table.exists(*var))
+    if (!mod_file->symbol_table.exists(var))
       {
-        warning("discarding shocks block declaration of the standard error of '" + *var + "' as it was not declared");
-        delete var;
+        warning("discarding shocks block declaration of the standard error of '" + var + "' as it was not declared");
         return;
       }
 
-  check_symbol_existence(*var);
-  int symb_id = mod_file->symbol_table.getID(*var);
+  check_symbol_existence(var);
+  int symb_id = mod_file->symbol_table.getID(var);
 
   if (var_shocks.find(symb_id) != var_shocks.end()
       || std_shocks.find(symb_id) != std_shocks.end())
-    error("shocks: variance or stderr of shock on " + *var + " declared twice");
+    error("shocks: variance or stderr of shock on " + var + " declared twice");
 
   std_shocks[symb_id] = value;
-
-  delete var;
 }
 
 void
-ParsingDriver::add_var_shock(string *var, expr_t value)
+ParsingDriver::add_var_shock(const string &var, expr_t value)
 {
   if (nostrict)
-    if (!mod_file->symbol_table.exists(*var))
+    if (!mod_file->symbol_table.exists(var))
       {
-        warning("discarding shocks block declaration of the variance of '" + *var + "' as it was not declared");
-        delete var;
+        warning("discarding shocks block declaration of the variance of '" + var + "' as it was not declared");
         return;
       }
 
-  check_symbol_existence(*var);
-  int symb_id = mod_file->symbol_table.getID(*var);
+  check_symbol_existence(var);
+  int symb_id = mod_file->symbol_table.getID(var);
 
   if (var_shocks.find(symb_id) != var_shocks.end()
       || std_shocks.find(symb_id) != std_shocks.end())
-    error("shocks: variance or stderr of shock on " + *var + " declared twice");
+    error("shocks: variance or stderr of shock on " + var + " declared twice");
 
   var_shocks[symb_id] = value;
-
-  delete var;
 }
 
 void
-ParsingDriver::add_covar_shock(string *var1, string *var2, expr_t value)
+ParsingDriver::add_covar_shock(const string &var1, const string &var2, expr_t value)
 {
   if (nostrict)
-    if (!mod_file->symbol_table.exists(*var1) || !mod_file->symbol_table.exists(*var2))
+    if (!mod_file->symbol_table.exists(var1) || !mod_file->symbol_table.exists(var2))
       {
-        warning("discarding shocks block declaration of the covariance of '" + *var1 + "' and '" + *var2 + "' as at least one was not declared");
-        delete var1;
-        delete var2;
+        warning("discarding shocks block declaration of the covariance of '" + var1 + "' and '" + var2 + "' as at least one was not declared");
         return;
       }
 
-  check_symbol_existence(*var1);
-  check_symbol_existence(*var2);
-  int symb_id1 = mod_file->symbol_table.getID(*var1);
-  int symb_id2 = mod_file->symbol_table.getID(*var2);
+  check_symbol_existence(var1);
+  check_symbol_existence(var2);
+  int symb_id1 = mod_file->symbol_table.getID(var1);
+  int symb_id2 = mod_file->symbol_table.getID(var2);
 
   pair<int, int> key(symb_id1, symb_id2), key_inv(symb_id2, symb_id1);
 
@@ -1136,31 +1001,26 @@ ParsingDriver::add_covar_shock(string *var1, string *var2, expr_t value)
       || covar_shocks.find(key_inv) != covar_shocks.end()
       || corr_shocks.find(key) != corr_shocks.end()
       || corr_shocks.find(key_inv) != corr_shocks.end())
-    error("shocks: covariance or correlation shock on variable pair (" + *var1 + ", "
-          + *var2 + ") declared twice");
+    error("shocks: covariance or correlation shock on variable pair (" + var1 + ", "
+          + var2 + ") declared twice");
 
   covar_shocks[key] = value;
-
-  delete var1;
-  delete var2;
 }
 
 void
-ParsingDriver::add_correl_shock(string *var1, string *var2, expr_t value)
+ParsingDriver::add_correl_shock(const string &var1, const string &var2, expr_t value)
 {
   if (nostrict)
-    if (!mod_file->symbol_table.exists(*var1) || !mod_file->symbol_table.exists(*var2))
+    if (!mod_file->symbol_table.exists(var1) || !mod_file->symbol_table.exists(var2))
       {
-        warning("discarding shocks block declaration of the correlation of '" + *var1 + "' and '" + *var2 + "' as at least one was not declared");
-        delete var1;
-        delete var2;
+        warning("discarding shocks block declaration of the correlation of '" + var1 + "' and '" + var2 + "' as at least one was not declared");
         return;
       }
 
-  check_symbol_existence(*var1);
-  check_symbol_existence(*var2);
-  int symb_id1 = mod_file->symbol_table.getID(*var1);
-  int symb_id2 = mod_file->symbol_table.getID(*var2);
+  check_symbol_existence(var1);
+  check_symbol_existence(var2);
+  int symb_id1 = mod_file->symbol_table.getID(var1);
+  int symb_id2 = mod_file->symbol_table.getID(var2);
 
   pair<int, int> key(symb_id1, symb_id2), key_inv(symb_id2, symb_id1);
 
@@ -1168,33 +1028,27 @@ ParsingDriver::add_correl_shock(string *var1, string *var2, expr_t value)
       || covar_shocks.find(key_inv) != covar_shocks.end()
       || corr_shocks.find(key) != corr_shocks.end()
       || corr_shocks.find(key_inv) != corr_shocks.end())
-    error("shocks: covariance or correlation shock on variable pair (" + *var1 + ", "
-          + *var2 + ") declared twice");
+    error("shocks: covariance or correlation shock on variable pair (" + var1 + ", "
+          + var2 + ") declared twice");
 
   corr_shocks[key] = value;
-
-  delete var1;
-  delete var2;
 }
 
 void
-ParsingDriver::add_period(string *p1, string *p2)
+ParsingDriver::add_period(const string &p1, const string &p2)
 {
-  int p1_val = stoi(*p1);
-  int p2_val = stoi(*p2);
+  int p1_val = stoi(p1);
+  int p2_val = stoi(p2);
   if (p1_val > p2_val)
     error("shocks/conditional_forecast_paths: can't have first period index greater than second index in range specification");
   det_shocks_periods.emplace_back(p1_val, p2_val);
-  delete p1;
-  delete p2;
 }
 
 void
-ParsingDriver::add_period(string *p1)
+ParsingDriver::add_period(const string &p1)
 {
-  int p1_val = stoi(*p1);
+  int p1_val = stoi(p1);
   det_shocks_periods.emplace_back(p1_val, p1_val);
-  delete p1;
 }
 
 void
@@ -1204,16 +1058,15 @@ ParsingDriver::add_value(expr_t value)
 }
 
 void
-ParsingDriver::add_value(string *v)
+ParsingDriver::add_value(const string &v)
 {
   expr_t id;
 
-  if (v->at(0) == '-')
-    id = data_tree->AddUMinus(data_tree->AddNonNegativeConstant(v->substr(1, string::npos)));
+  if (v.at(0) == '-')
+    id = data_tree->AddUMinus(data_tree->AddNonNegativeConstant(v.substr(1, string::npos)));
   else
-    id = data_tree->AddNonNegativeConstant(*v);
+    id = data_tree->AddNonNegativeConstant(v);
 
-  delete v;
   det_shocks_values.push_back(id);
 }
 
@@ -1241,28 +1094,25 @@ ParsingDriver::end_svar_identification()
 }
 
 void
-ParsingDriver::combine_lag_and_restriction(string *lag)
+ParsingDriver::combine_lag_and_restriction(const string &lag)
 {
-  int current_lag = stoi(*lag);
+  int current_lag = stoi(lag);
 
-  for (SvarIdentificationStatement::svar_identification_restrictions_t::const_iterator it = svar_ident_restrictions.begin();
-       it != svar_ident_restrictions.end(); it++)
-    if (it->lag == current_lag)
-      error("lag " + *lag + " used more than once.");
+  for (const auto &it : svar_ident_restrictions)
+    if (it.lag == current_lag)
+      error("lag " + lag + " used more than once.");
 
-  for (map<int, vector<int>>::const_iterator it = svar_equation_restrictions.begin();
-       it != svar_equation_restrictions.end(); it++)
-    for (auto it1 = it->second.begin();
-         it1 != it->second.end(); it1++)
+  for (const auto &it : svar_equation_restrictions)
+    for (auto it1 : it.second)
       {
         SvarIdentificationStatement::svar_identification_restriction new_restriction;
-        new_restriction.equation = it->first;
+        new_restriction.equation = it.first;
         if (current_lag > 0)
-          new_restriction.restriction_nbr = ++svar_Ri_restriction_nbr[it->first];
+          new_restriction.restriction_nbr = ++svar_Ri_restriction_nbr[it.first];
         else
-          new_restriction.restriction_nbr = ++svar_Qi_restriction_nbr[it->first];
+          new_restriction.restriction_nbr = ++svar_Qi_restriction_nbr[it.first];
         new_restriction.lag = current_lag;
-        new_restriction.variable = *it1;
+        new_restriction.variable = it1;
         new_restriction.value = data_tree->One;
         svar_ident_restrictions.push_back(new_restriction);
       }
@@ -1271,44 +1121,40 @@ ParsingDriver::combine_lag_and_restriction(string *lag)
   svar_upper_cholesky = false;
   svar_lower_cholesky = false;
   svar_equation_restrictions.clear();
-  delete lag;
 }
 
 void
-ParsingDriver::add_restriction_in_equation(string *equation)
+ParsingDriver::add_restriction_in_equation(const string &equation)
 {
-  int eqn = stoi(*equation);
+  int eqn = stoi(equation);
   if (eqn < 1)
     error("equation numbers must be greater than or equal to 1.");
 
   if (svar_equation_restrictions.count(eqn) > 0)
-    error("equation number " + *equation + " referenced more than once under a single lag.");
+    error("equation number " + equation + " referenced more than once under a single lag.");
 
   svar_equation_restrictions[eqn] = svar_restriction_symbols;
 
   svar_restriction_symbols.clear();
-  delete equation;
 }
 
 void
-ParsingDriver::add_in_svar_restriction_symbols(string *tmp_var)
+ParsingDriver::add_in_svar_restriction_symbols(const string &tmp_var)
 {
-  check_symbol_existence(*tmp_var);
-  int symb_id = mod_file->symbol_table.getID(*tmp_var);
+  check_symbol_existence(tmp_var);
+  int symb_id = mod_file->symbol_table.getID(tmp_var);
 
-  for (vector<int>::const_iterator viit = svar_restriction_symbols.begin();
-       viit != svar_restriction_symbols.end(); viit++)
-    if (symb_id == *viit)
-      error(*tmp_var + " restriction added twice.");
+  for (const auto &viit : svar_restriction_symbols)
+    if (symb_id == viit)
+      error(tmp_var + " restriction added twice.");
 
   svar_restriction_symbols.push_back(symb_id);
-  delete tmp_var;
 }
 
 void
-ParsingDriver::add_restriction_equation_nbr(string *eq_nbr)
+ParsingDriver::add_restriction_equation_nbr(const string &eq_nbr)
 {
-  svar_equation_nbr = stoi(*eq_nbr);
+  svar_equation_nbr = stoi(eq_nbr);
   svar_left_handside = true;
   // reinitialize restriction type that must be set from the first restriction element
   svar_restriction_type = ParsingDriver::NOT_SET;
@@ -1324,7 +1170,7 @@ ParsingDriver::add_restriction_equal()
 }
 
 void
-ParsingDriver::add_positive_restriction_element(expr_t value, string *variable, string *lag)
+ParsingDriver::add_positive_restriction_element(expr_t value, const string &variable, const string &lag)
 {
   // if the expression is not on the left handside, change its sign
   if (!svar_left_handside)
@@ -1334,7 +1180,7 @@ ParsingDriver::add_positive_restriction_element(expr_t value, string *variable,
 }
 
 void
-ParsingDriver::add_positive_restriction_element(string *variable, string *lag)
+ParsingDriver::add_positive_restriction_element(const string &variable, const string &lag)
 {
   expr_t value(data_tree->One);
 
@@ -1346,7 +1192,7 @@ ParsingDriver::add_positive_restriction_element(string *variable, string *lag)
 }
 
 void
-ParsingDriver::add_negative_restriction_element(expr_t value, string *variable, string *lag)
+ParsingDriver::add_negative_restriction_element(expr_t value, const string &variable, const string &lag)
 {
   // if the expression is on the left handside, change its sign
   if (svar_left_handside)
@@ -1356,7 +1202,7 @@ ParsingDriver::add_negative_restriction_element(expr_t value, string *variable,
 }
 
 void
-ParsingDriver::add_negative_restriction_element(string *variable, string *lag)
+ParsingDriver::add_negative_restriction_element(const string &variable, const string &lag)
 {
   expr_t value(data_tree->One);
 
@@ -1368,12 +1214,12 @@ ParsingDriver::add_negative_restriction_element(string *variable, string *lag)
 }
 
 void
-ParsingDriver::add_restriction_element(expr_t value, string *variable, string *lag)
+ParsingDriver::add_restriction_element(expr_t value, const string &variable, const string &lag)
 {
-  check_symbol_existence(*variable);
-  int symb_id = mod_file->symbol_table.getID(*variable);
+  check_symbol_existence(variable);
+  int symb_id = mod_file->symbol_table.getID(variable);
 
-  int current_lag = stoi(*lag);
+  int current_lag = stoi(lag);
   if (svar_restriction_type == ParsingDriver::NOT_SET)
     {
       if (current_lag == 0)
@@ -1461,16 +1307,15 @@ ParsingDriver::end_of_row()
 }
 
 void
-ParsingDriver::add_to_row_const(string *v)
+ParsingDriver::add_to_row_const(const string &v)
 {
   expr_t id;
 
-  if (v->at(0) == '-')
-    id = data_tree->AddUMinus(data_tree->AddNonNegativeConstant(v->substr(1, string::npos)));
+  if (v.at(0) == '-')
+    id = data_tree->AddUMinus(data_tree->AddNonNegativeConstant(v.substr(1, string::npos)));
   else
-    id = data_tree->AddNonNegativeConstant(*v);
+    id = data_tree->AddNonNegativeConstant(v);
 
-  delete v;
   sigmae_row.push_back(id);
 }
 
@@ -1488,69 +1333,46 @@ ParsingDriver::steady()
 }
 
 void
-ParsingDriver::option_num(const string &name_option, string *opt1, string *opt2)
+ParsingDriver::option_num(string name_option, string opt1, string opt2)
 {
   if (options_list.paired_num_options.find(name_option)
       != options_list.paired_num_options.end())
     error("option " + name_option + " declared twice");
 
-  options_list.paired_num_options[name_option] = { *opt1, *opt2 };
-  delete opt1;
-  delete opt2;
+  options_list.paired_num_options[move(name_option)] = { move(opt1), move(opt2) };
 }
 
 void
-ParsingDriver::option_num(const string &name_option, string *opt)
-{
-  option_num(name_option, *opt);
-  delete opt;
-}
-
-void
-ParsingDriver::option_num(const string &name_option, const string &opt)
+ParsingDriver::option_num(string name_option, string opt)
 {
   if (options_list.num_options.find(name_option) != options_list.num_options.end())
     error("option " + name_option + " declared twice");
 
-  options_list.num_options[name_option] = opt;
+  options_list.num_options[move(name_option)] = move(opt);
 }
 
 void
-ParsingDriver::option_str(const string &name_option, string *opt)
-{
-  option_str(name_option, *opt);
-  delete opt;
-}
-
-void
-ParsingDriver::option_str(const string &name_option, const string &opt)
+ParsingDriver::option_str(string name_option, string opt)
 {
   if (options_list.string_options.find(name_option)
       != options_list.string_options.end())
     error("option " + name_option + " declared twice");
 
-  options_list.string_options[name_option] = opt;
-}
-
-void
-ParsingDriver::option_date(const string &name_option, string *opt)
-{
-  option_date(name_option, *opt);
-  delete opt;
+  options_list.string_options[move(name_option)] = move(opt);
 }
 
 void
-ParsingDriver::option_date(const string &name_option, const string &opt)
+ParsingDriver::option_date(string name_option, string opt)
 {
   if (options_list.date_options.find(name_option)
       != options_list.date_options.end())
     error("option " + name_option + " declared twice");
 
-  options_list.date_options[name_option] = opt;
+  options_list.date_options[move(name_option)] = move(opt);
 }
 
 void
-ParsingDriver::option_symbol_list(const string &name_option)
+ParsingDriver::option_symbol_list(string name_option)
 {
   if (options_list.symbol_list_options.find(name_option)
       != options_list.symbol_list_options.end())
@@ -1574,37 +1396,34 @@ ParsingDriver::option_symbol_list(const string &name_option)
           error("Variables passed to the parameters option of the markov_switching statement must be parameters. Caused by: " + *it);
     }
 
-  options_list.symbol_list_options[name_option] = symbol_list;
+  options_list.symbol_list_options[move(name_option)] = symbol_list;
   symbol_list.clear();
 }
 
 void
-ParsingDriver::option_vec_int(const string &name_option, const vector<int> *opt)
+ParsingDriver::option_vec_int(string name_option, vector<int> opt)
 {
   if (options_list.vector_int_options.find(name_option)
       != options_list.vector_int_options.end())
     error("option " + name_option + " declared twice");
 
-  if ((*opt).empty())
+  if (opt.empty())
     error("option " + name_option + " was passed an empty vector.");
 
-  options_list.vector_int_options[name_option] = *opt;
-  delete opt;
+  options_list.vector_int_options[move(name_option)] = move(opt);
 }
 
 void
-ParsingDriver::option_vec_str(const string &name_option, const vector<string> *opt)
+ParsingDriver::option_vec_str(string name_option, vector<string> opt)
 {
   if (options_list.vector_str_options.find(name_option)
       != options_list.vector_str_options.end())
     error("option " + name_option + " declared twice");
 
-  if ((*opt).empty())
+  if (opt.empty())
     error("option " + name_option + " was passed an empty vector.");
 
-  options_list.vector_str_options[name_option] = *opt;
-
-  delete opt;
+  options_list.vector_str_options[move(name_option)] = move(opt);
 }
 
 void
@@ -1614,12 +1433,11 @@ ParsingDriver::linear()
 }
 
 void
-ParsingDriver::add_in_symbol_list(string *tmp_var)
+ParsingDriver::add_in_symbol_list(const string &tmp_var)
 {
-  if (*tmp_var != ":")
-    check_symbol_existence(*tmp_var);
-  symbol_list.addSymbol(*tmp_var);
-  delete tmp_var;
+  if (tmp_var != ":")
+    check_symbol_existence(tmp_var);
+  symbol_list.addSymbol(tmp_var);
 }
 
 void
@@ -1643,7 +1461,7 @@ ParsingDriver::var_model()
   OptionsList::string_options_t::const_iterator it = options_list.string_options.find("var.model_name");
   if (it == options_list.string_options.end())
     error("You must pass the model_name option to the var_model statement.");
-  const string *name = new string(it->second);
+  auto name = it->second;
 
   if (options_list.vector_str_options.find("var.eqtags") != options_list.vector_str_options.end())
     if (!symbol_list.empty())
@@ -1655,7 +1473,7 @@ ParsingDriver::var_model()
     if (options_list.num_options.find("var.order") == options_list.num_options.end())
       error("You must pass the order option when passing a symbol list to the var_model statement");
 
-  mod_file->addStatement(new VarModelStatement(symbol_list, options_list, *name, mod_file->symbol_table));
+  mod_file->addStatement(new VarModelStatement(symbol_list, options_list, name, mod_file->symbol_table));
   var_map[it->second] = symbol_list.getSymbols();
   symbol_list.clear();
   options_list.clear();
@@ -1696,7 +1514,7 @@ ParsingDriver::add_estimated_params_element()
             error(estim_params.name + " must be an endogenous or an exogenous variable");
           break;
         case 2:
-          check_symbol_is_parameter(&estim_params.name);
+          check_symbol_is_parameter(estim_params.name);
           break;
         case 3:
           check_symbol_existence(estim_params.name2);
@@ -1758,7 +1576,7 @@ ParsingDriver::set_unit_root_vars()
 }
 
 void
-ParsingDriver::set_time(string *arg)
+ParsingDriver::set_time(const string &arg)
 {
   option_date("initial_period", arg);
   mod_file->addStatement(new SetTimeStatement(options_list));
@@ -1773,140 +1591,124 @@ ParsingDriver::estimation_data()
 }
 
 void
-ParsingDriver::set_subsamples(string *name1, string *name2)
+ParsingDriver::set_subsamples(string name1, string name2)
 {
-  check_symbol_existence(*name1);
-  if (!name2->empty())
-    check_symbol_existence(*name2);
+  check_symbol_existence(name1);
+  if (!name2.empty())
+    check_symbol_existence(name2);
 
-  mod_file->addStatement(new SubsamplesStatement(*name1, *name2, subsample_declaration_map,
+  mod_file->addStatement(new SubsamplesStatement(name1, name2, subsample_declaration_map,
                                                  mod_file->symbol_table));
-  subsample_declarations[{ *name1, *name2 }] = subsample_declaration_map;
+  subsample_declarations[{ move(name1), move(name2) }] = subsample_declaration_map;
   subsample_declaration_map.clear();
-  delete name1;
-  delete name2;
 }
 
 void
-ParsingDriver::copy_subsamples(string *to_name1, string *to_name2, string *from_name1, string *from_name2)
+ParsingDriver::copy_subsamples(string to_name1, string to_name2, string from_name1, string from_name2)
 {
-  check_symbol_existence(*to_name1);
-  check_symbol_existence(*from_name1);
-  if (!to_name2->empty())
-    check_symbol_existence(*to_name2);
-  if (!from_name2->empty())
-    check_symbol_existence(*from_name2);
+  check_symbol_existence(to_name1);
+  check_symbol_existence(from_name1);
+  if (!to_name2.empty())
+    check_symbol_existence(to_name2);
+  if (!from_name2.empty())
+    check_symbol_existence(from_name2);
 
-  if (subsample_declarations.find({ *from_name1, *from_name2 }) == subsample_declarations.end())
+  if (subsample_declarations.find({ from_name1, from_name2 }) == subsample_declarations.end())
     {
-      string err = *from_name1;
-      if (!from_name2->empty())
-        err.append(",").append(*from_name2);
+      string err{from_name1};
+      if (!from_name2.empty())
+        err.append(",").append(from_name2);
       error(err + " does not have an associated subsample statement.");
     }
 
-  mod_file->addStatement(new SubsamplesEqualStatement(*to_name1, *to_name2, *from_name1, *from_name2,
+  mod_file->addStatement(new SubsamplesEqualStatement(to_name1, to_name2, from_name1, from_name2,
                                                       mod_file->symbol_table));
 
-  subsample_declarations[{ *to_name1, *to_name2 }]
-    = subsample_declarations[{ *from_name1, *from_name2 }];
-
-  delete to_name1;
-  delete to_name2;
-  delete from_name1;
-  delete from_name2;
+  subsample_declarations[{ move(to_name1), move(to_name2) }]
+    = subsample_declarations[{ move(from_name1), move(from_name2) }];
 }
 
 void
-ParsingDriver::check_symbol_is_statement_variable(string *name)
+ParsingDriver::check_symbol_is_statement_variable(const string &name)
 {
-  check_symbol_existence(*name);
-  int symb_id = mod_file->symbol_table.getID(*name);
+  check_symbol_existence(name);
+  int symb_id = mod_file->symbol_table.getID(name);
   if (mod_file->symbol_table.getType(symb_id) != SymbolType::statementDeclaredVariable)
-    error(*name + " is not a variable assigned in a statement");
+    error(name + " is not a variable assigned in a statement");
 }
 
 void
-ParsingDriver::set_subsample_name_equal_to_date_range(string *name, string *date1, string *date2)
+ParsingDriver::set_subsample_name_equal_to_date_range(string name, string date1, string date2)
 {
-  if (subsample_declaration_map.find(*name) != subsample_declaration_map.end())
-    error("Symbol " + *name + " may only be assigned once in a SUBSAMPLE statement");
-  subsample_declaration_map[*name] = { *date1, *date2 };
-  delete name;
-  delete date1;
-  delete date2;
+  if (subsample_declaration_map.find(name) != subsample_declaration_map.end())
+    error("Symbol " + name + " may only be assigned once in a SUBSAMPLE statement");
+  subsample_declaration_map[move(name)] = { move(date1), move(date2) };
 }
 
 void
-ParsingDriver::check_subsample_declaration_exists(string *name1, string *subsample_name)
+ParsingDriver::check_subsample_declaration_exists(const string &name1, const string &subsample_name)
 {
-  if (subsample_name->empty())
+  if (subsample_name.empty())
     return;
 
-  string *str_empty = new string("");
-  check_subsample_declaration_exists(name1, str_empty, subsample_name);
-  delete str_empty;
+  check_subsample_declaration_exists(name1, "", subsample_name);
 }
 
 void
-ParsingDriver::check_subsample_declaration_exists(string *name1, string *name2, string *subsample_name)
+ParsingDriver::check_subsample_declaration_exists(const string &name1, const string &name2, const string &subsample_name)
 {
-  if (subsample_name->empty())
+  if (subsample_name.empty())
     return;
 
-  check_symbol_existence(*name1);
-  if (!name2->empty())
-    check_symbol_existence(*name2);
+  check_symbol_existence(name1);
+  if (!name2.empty())
+    check_symbol_existence(name2);
 
-  subsample_declarations_t::const_iterator it = subsample_declarations.find({ *name1, *name2 });
+  auto it = subsample_declarations.find({ name1, name2 });
   if (it == subsample_declarations.end())
     {
-      it = subsample_declarations.find({ *name2, *name1 });
+      it = subsample_declarations.find({ name2, name1 });
       if (it == subsample_declarations.end())
         {
-          string err = *name1;
-          if (!name2->empty())
-            err.append(",").append(*name2);
+          string err{name1};
+          if (!name2.empty())
+            err.append(",").append(name2);
           error("A subsample statement has not been issued for " + err);
         }
     }
 
-  SubsamplesStatement::subsample_declaration_map_t tmp_map = it->second;
-  if (tmp_map.find(*subsample_name) == tmp_map.end())
-    error("The subsample name " + *subsample_name + " was not previously declared in a subsample statement.");
+  auto tmp_map = it->second;
+  if (tmp_map.find(subsample_name) == tmp_map.end())
+    error("The subsample name " + subsample_name + " was not previously declared in a subsample statement.");
 }
 
 void
-ParsingDriver::set_prior(string *name, string *subsample_name)
+ParsingDriver::set_prior(const string &name, const string &subsample_name)
 {
   check_symbol_is_parameter(name);
   check_subsample_declaration_exists(name, subsample_name);
-  mod_file->addStatement(new PriorStatement(*name, *subsample_name, prior_shape, prior_variance, options_list));
+  mod_file->addStatement(new PriorStatement(name, subsample_name, prior_shape, prior_variance, options_list));
   options_list.clear();
   set_prior_variance();
   prior_shape = PriorDistributions::noShape;
-  delete name;
-  delete subsample_name;
 }
 
 void
-ParsingDriver::set_joint_prior(vector<string *> *symbol_vec)
+ParsingDriver::set_joint_prior(const vector<string> &symbol_vec)
 {
-  for (vector<string *>::const_iterator it = symbol_vec->begin(); it != symbol_vec->end(); it++)
-    add_joint_parameter(*it);
+  for (auto &it : symbol_vec)
+    add_joint_parameter(it);
   mod_file->addStatement(new JointPriorStatement(joint_parameters, prior_shape, options_list));
   joint_parameters.clear();
   options_list.clear();
   prior_shape = PriorDistributions::noShape;
-  delete symbol_vec;
 }
 
 void
-ParsingDriver::add_joint_parameter(string *name)
+ParsingDriver::add_joint_parameter(string name)
 {
   check_symbol_is_parameter(name);
-  joint_parameters.push_back(*name);
-  delete name;
+  joint_parameters.push_back(move(name));
 }
 
 void
@@ -1916,92 +1718,82 @@ ParsingDriver::set_prior_variance(expr_t variance)
 }
 
 void
-ParsingDriver::copy_prior(string *to_declaration_type, string *to_name1, string *to_name2, string *to_subsample_name,
-                          string *from_declaration_type, string *from_name1, string *from_name2, string *from_subsample_name)
+ParsingDriver::copy_prior(const string &to_declaration_type, const string &to_name1,
+                          const string &to_name2, const string &to_subsample_name,
+                          const string &from_declaration_type, const string &from_name1,
+                          const string &from_name2, const string &from_subsample_name)
 {
-  if (strcmp(to_declaration_type->c_str(), "par") == 0)
+  if (to_declaration_type == "par")
     check_symbol_is_parameter(to_name1);
   else
     {
       check_symbol_is_endogenous_or_exogenous(to_name1);
-      if (!to_name2->empty())
+      if (!to_name2.empty())
         check_symbol_is_endogenous_or_exogenous(to_name2);
     }
 
-  if (strcmp(from_declaration_type->c_str(), "par") == 0)
+  if (from_declaration_type == "par")
     check_symbol_is_parameter(from_name1);
   else
     {
       check_symbol_is_endogenous_or_exogenous(from_name1);
-      if (!from_name2->empty())
+      if (!from_name2.empty())
         check_symbol_is_endogenous_or_exogenous(from_name2);
     }
 
-  mod_file->addStatement(new PriorEqualStatement(*to_declaration_type, *to_name1, *to_name2, *to_subsample_name,
-                                                 *from_declaration_type, *from_name1, *from_name2, *from_subsample_name,
+  mod_file->addStatement(new PriorEqualStatement(to_declaration_type, to_name1,
+                                                 to_name2, to_subsample_name,
+                                                 from_declaration_type, from_name1,
+                                                 from_name2, from_subsample_name,
                                                  mod_file->symbol_table));
 
-  delete to_declaration_type;
-  delete to_name1;
-  delete to_name2;
-  delete to_subsample_name;
-  delete from_declaration_type;
-  delete from_name1;
-  delete from_name2;
-  delete from_subsample_name;
 }
 
 void
-ParsingDriver::set_options(string *name, string *subsample_name)
+ParsingDriver::set_options(const string &name, const string &subsample_name)
 {
   check_symbol_is_parameter(name);
   check_subsample_declaration_exists(name, subsample_name);
-  mod_file->addStatement(new OptionsStatement(*name, *subsample_name, options_list));
+  mod_file->addStatement(new OptionsStatement(name, subsample_name, options_list));
   options_list.clear();
-  delete name;
-  delete subsample_name;
 }
 
 void
-ParsingDriver::copy_options(string *to_declaration_type, string *to_name1, string *to_name2, string *to_subsample_name,
-                            string *from_declaration_type, string *from_name1, string *from_name2, string *from_subsample_name)
+ParsingDriver::copy_options(const string &to_declaration_type, const string &to_name1,
+                            const string &to_name2, const string &to_subsample_name,
+                            const string &from_declaration_type, const string &from_name1,
+                            const string &from_name2, const string &from_subsample_name)
 {
-  if (strcmp(to_declaration_type->c_str(), "par") == 0)
+  if (to_declaration_type == "par")
     check_symbol_is_parameter(to_name1);
   else
     {
       check_symbol_is_endogenous_or_exogenous(to_name1);
-      if (!to_name2->empty())
+      if (!to_name2.empty())
         check_symbol_is_endogenous_or_exogenous(to_name2);
     }
 
-  if (strcmp(from_declaration_type->c_str(), "par") == 0)
+  if (from_declaration_type == "par")
     check_symbol_is_parameter(from_name1);
   else
     {
       check_symbol_is_endogenous_or_exogenous(from_name1);
-      if (!from_name2->empty())
+      if (!from_name2.empty())
         check_symbol_is_endogenous_or_exogenous(from_name2);
     }
 
-  mod_file->addStatement(new OptionsEqualStatement(*to_declaration_type, *to_name1, *to_name2, *to_subsample_name,
-                                                   *from_declaration_type, *from_name1, *from_name2, *from_subsample_name,
+  mod_file->addStatement(new OptionsEqualStatement(to_declaration_type, to_name1,
+                                                   to_name2, to_subsample_name,
+                                                   from_declaration_type, from_name1,
+                                                   from_name2, from_subsample_name,
                                                    mod_file->symbol_table));
-  delete to_declaration_type;
-  delete to_name1;
-  delete to_name2;
-  delete to_subsample_name;
-  delete from_declaration_type;
-  delete from_name1;
-  delete from_name2;
-  delete from_subsample_name;
 }
 
 void
-ParsingDriver::check_symbol_is_endogenous_or_exogenous(string *name)
+ParsingDriver::check_symbol_is_endogenous_or_exogenous(const string &name)
 {
-  check_symbol_existence(*name);
-  int symb_id = mod_file->symbol_table.getID(*name);
+  check_symbol_existence(name);
+  int symb_id = mod_file->symbol_table.getID(name);
   switch (mod_file->symbol_table.getType(symb_id))
     {
     case SymbolType::endogenous:
@@ -2009,77 +1801,67 @@ ParsingDriver::check_symbol_is_endogenous_or_exogenous(string *name)
     case SymbolType::exogenousDet:
       break;
     default:
-      error(*name + " is neither endogenous or exogenous.");
+      error(name + " is neither endogenous or exogenous.");
     }
 }
 
 void
-ParsingDriver::check_symbol_is_exogenous(string *name)
+ParsingDriver::check_symbol_is_exogenous(const string &name)
 {
-  check_symbol_existence(*name);
-  int symb_id = mod_file->symbol_table.getID(*name);
+  check_symbol_existence(name);
+  int symb_id = mod_file->symbol_table.getID(name);
   switch (mod_file->symbol_table.getType(symb_id))
     {
     case SymbolType::exogenous:
     case SymbolType::exogenousDet:
       break;
     default:
-      error(*name + " is not exogenous.");
+      error(name + " is not exogenous.");
     }
 }
 
 void
-ParsingDriver::set_std_prior(string *name, string *subsample_name)
+ParsingDriver::set_std_prior(const string &name, const string &subsample_name)
 {
   check_symbol_is_endogenous_or_exogenous(name);
   check_subsample_declaration_exists(name, subsample_name);
-  mod_file->addStatement(new StdPriorStatement(*name, *subsample_name, prior_shape, prior_variance,
+  mod_file->addStatement(new StdPriorStatement(name, subsample_name, prior_shape, prior_variance,
                                                options_list, mod_file->symbol_table));
   options_list.clear();
   set_prior_variance();
   prior_shape = PriorDistributions::noShape;
-  delete name;
-  delete subsample_name;
 }
 
 void
-ParsingDriver::set_std_options(string *name, string *subsample_name)
+ParsingDriver::set_std_options(const string &name, const string &subsample_name)
 {
   check_symbol_is_endogenous_or_exogenous(name);
   check_subsample_declaration_exists(name, subsample_name);
-  mod_file->addStatement(new StdOptionsStatement(*name, *subsample_name, options_list, mod_file->symbol_table));
+  mod_file->addStatement(new StdOptionsStatement(name, subsample_name, options_list, mod_file->symbol_table));
   options_list.clear();
-  delete name;
-  delete subsample_name;
 }
 
 void
-ParsingDriver::set_corr_prior(string *name1, string *name2, string *subsample_name)
+ParsingDriver::set_corr_prior(const string &name1, const string &name2, const string &subsample_name)
 {
   check_symbol_is_endogenous_or_exogenous(name1);
   check_symbol_is_endogenous_or_exogenous(name2);
   check_subsample_declaration_exists(name1, name2, subsample_name);
-  mod_file->addStatement(new CorrPriorStatement(*name1, *name2, *subsample_name, prior_shape, prior_variance,
+  mod_file->addStatement(new CorrPriorStatement(name1, name2, subsample_name, prior_shape, prior_variance,
                                                 options_list, mod_file->symbol_table));
   options_list.clear();
   set_prior_variance();
   prior_shape = PriorDistributions::noShape;
-  delete name1;
-  delete name2;
-  delete subsample_name;
 }
 
 void
-ParsingDriver::set_corr_options(string *name1, string *name2, string *subsample_name)
+ParsingDriver::set_corr_options(const string &name1, const string &name2, const string &subsample_name)
 {
   check_symbol_is_endogenous_or_exogenous(name1);
   check_symbol_is_endogenous_or_exogenous(name2);
   check_subsample_declaration_exists(name1, name2, subsample_name);
-  mod_file->addStatement(new CorrOptionsStatement(*name1, *name2, *subsample_name, options_list, mod_file->symbol_table));
+  mod_file->addStatement(new CorrOptionsStatement(name1, name2, subsample_name, options_list, mod_file->symbol_table));
   options_list.clear();
-  delete name1;
-  delete name2;
-  delete subsample_name;
 }
 
 void
@@ -2108,21 +1890,17 @@ ParsingDriver::optim_options_helper(const string &name)
 }
 
 void
-ParsingDriver::optim_options_string(string *name, string *value)
+ParsingDriver::optim_options_string(const string &name, const string &value)
 {
-  optim_options_helper(*name);
-  options_list.string_options["optim_opt"] += "''" + *value + "''";
-  delete name;
-  delete value;
+  optim_options_helper(name);
+  options_list.string_options["optim_opt"] += "''" + value + "''";
 }
 
 void
-ParsingDriver::optim_options_num(string *name, string *value)
+ParsingDriver::optim_options_num(const string &name, const string &value)
 {
-  optim_options_helper(*name);
-  options_list.string_options["optim_opt"] += *value;
-  delete name;
-  delete value;
+  optim_options_helper(name);
+  options_list.string_options["optim_opt"] += value;
 }
 
 void
@@ -2137,21 +1915,17 @@ ParsingDriver::sampling_options_helper(const string &name)
 }
 
 void
-ParsingDriver::sampling_options_string(string *name, string *value)
+ParsingDriver::sampling_options_string(const string &name, const string &value)
 {
-  sampling_options_helper(*name);
-  options_list.string_options["posterior_sampler_options.sampling_opt"] += "''" + *value + "''";
-  delete name;
-  delete value;
+  sampling_options_helper(name);
+  options_list.string_options["posterior_sampler_options.sampling_opt"] += "''" + value + "''";
 }
 
 void
-ParsingDriver::sampling_options_num(string *name, string *value)
+ParsingDriver::sampling_options_num(const string &name, const string &value)
 {
-  sampling_options_helper(*name);
-  options_list.string_options["posterior_sampler_options.sampling_opt"] += *value;
-  delete name;
-  delete value;
+  sampling_options_helper(name);
+  options_list.string_options["posterior_sampler_options.sampling_opt"] += value;
 }
 
 void
@@ -2162,14 +1936,13 @@ ParsingDriver::check_varobs()
 }
 
 void
-ParsingDriver::add_varobs(string *name)
+ParsingDriver::add_varobs(const string &name)
 {
-  check_symbol_existence(*name);
-  int symb_id = mod_file->symbol_table.getID(*name);
+  check_symbol_existence(name);
+  int symb_id = mod_file->symbol_table.getID(name);
   if (mod_file->symbol_table.getType(symb_id) != SymbolType::endogenous)
-    error("varobs: " + *name + " is not an endogenous variable");
+    error("varobs: " + name + " is not an endogenous variable");
   mod_file->symbol_table.addObservedVariable(symb_id);
-  delete name;
 }
 
 void
@@ -2180,14 +1953,13 @@ ParsingDriver::check_varexobs()
 }
 
 void
-ParsingDriver::add_varexobs(string *name)
+ParsingDriver::add_varexobs(const string &name)
 {
-  check_symbol_existence(*name);
-  int symb_id = mod_file->symbol_table.getID(*name);
+  check_symbol_existence(name);
+  int symb_id = mod_file->symbol_table.getID(name);
   if (mod_file->symbol_table.getType(symb_id) != SymbolType::exogenous)
-    error("varexobs: " + *name + " is not an exogenous variable");
+    error("varexobs: " + name + " is not an exogenous variable");
   mod_file->symbol_table.addObservedExogenousVariable(symb_id);
-  delete name;
 }
 
 void
@@ -2198,47 +1970,43 @@ ParsingDriver::set_trends()
 }
 
 void
-ParsingDriver::set_trend_element(string *arg1, expr_t arg2)
+ParsingDriver::set_trend_element(string arg1, expr_t arg2)
 {
-  check_symbol_existence(*arg1);
-  if (trend_elements.find(*arg1) != trend_elements.end())
-    error("observation_trends: " + *arg1 + " declared twice");
-  trend_elements[*arg1] = arg2;
-  delete arg1;
+  check_symbol_existence(arg1);
+  if (trend_elements.find(arg1) != trend_elements.end())
+    error("observation_trends: " + arg1 + " declared twice");
+  trend_elements[move(arg1)] = arg2;
 }
 
 void
-ParsingDriver::set_optim_weights(string *name, expr_t value)
+ParsingDriver::set_optim_weights(string name, expr_t value)
 {
-  check_symbol_existence(*name);
-  if (mod_file->symbol_table.getType(*name) != SymbolType::endogenous)
-    error("optim_weights: " + *name + " isn't an endogenous variable");
-  if (var_weights.find(*name) != var_weights.end())
-    error("optim_weights: " + *name + " declared twice");
-  var_weights[*name] = value;
-  delete name;
+  check_symbol_existence(name);
+  if (mod_file->symbol_table.getType(name) != SymbolType::endogenous)
+    error("optim_weights: " + name + " isn't an endogenous variable");
+  if (var_weights.find(name) != var_weights.end())
+    error("optim_weights: " + name + " declared twice");
+  var_weights[move(name)] = move(value);
 }
 
 void
-ParsingDriver::set_optim_weights(string *name1, string *name2, expr_t value)
+ParsingDriver::set_optim_weights(const string &name1, const string &name2, expr_t value)
 {
-  check_symbol_existence(*name1);
-  if (mod_file->symbol_table.getType(*name1) != SymbolType::endogenous)
-    error("optim_weights: " + *name1 + " isn't an endogenous variable");
+  check_symbol_existence(name1);
+  if (mod_file->symbol_table.getType(name1) != SymbolType::endogenous)
+    error("optim_weights: " + name1 + " isn't an endogenous variable");
 
-  check_symbol_existence(*name2);
-  if (mod_file->symbol_table.getType(*name2) != SymbolType::endogenous)
-    error("optim_weights: " + *name2 + " isn't an endogenous variable");
+  check_symbol_existence(name2);
+  if (mod_file->symbol_table.getType(name2) != SymbolType::endogenous)
+    error("optim_weights: " + name2 + " isn't an endogenous variable");
 
-  pair<string, string> covar_key(*name1, *name2);
+  pair<string, string> covar_key{name1, name2};
 
   if (covar_weights.find(covar_key) != covar_weights.end())
-    error("optim_weights: pair of variables (" + *name1 + ", " + *name2
+    error("optim_weights: pair of variables (" + name1 + ", " + name2
           + ") declared twice");
 
   covar_weights[covar_key] = value;
-  delete name1;
-  delete name2;
 }
 
 void
@@ -2265,33 +2033,29 @@ ParsingDriver::run_osr()
 }
 
 void
-ParsingDriver::run_dynatype(string *filename)
+ParsingDriver::run_dynatype(const string &filename)
 {
-  mod_file->addStatement(new DynaTypeStatement(symbol_list, *filename));
+  mod_file->addStatement(new DynaTypeStatement(symbol_list, filename));
   symbol_list.clear();
-  delete filename;
 }
 
 void
-ParsingDriver::run_dynasave(string *filename)
+ParsingDriver::run_dynasave(const string &filename)
 {
-  mod_file->addStatement(new DynaSaveStatement(symbol_list, *filename));
+  mod_file->addStatement(new DynaSaveStatement(symbol_list, filename));
   symbol_list.clear();
-  delete filename;
 }
 
 void
-ParsingDriver::run_load_params_and_steady_state(string *filename)
+ParsingDriver::run_load_params_and_steady_state(const string &filename)
 {
-  mod_file->addStatement(new LoadParamsAndSteadyStateStatement(*filename, mod_file->symbol_table, warnings));
-  delete filename;
+  mod_file->addStatement(new LoadParamsAndSteadyStateStatement(filename, mod_file->symbol_table, warnings));
 }
 
 void
-ParsingDriver::run_save_params_and_steady_state(string *filename)
+ParsingDriver::run_save_params_and_steady_state(const string &filename)
 {
-  mod_file->addStatement(new SaveParamsAndSteadyStateStatement(*filename));
-  delete filename;
+  mod_file->addStatement(new SaveParamsAndSteadyStateStatement(filename));
 }
 
 void
@@ -2302,14 +2066,12 @@ ParsingDriver::run_identification()
 }
 
 void
-ParsingDriver::add_mc_filename(string *filename, string *prior)
+ParsingDriver::add_mc_filename(string filename, string prior)
 {
   for (auto & it : filename_list)
-    if (it.first == *filename)
-      error("model_comparison: filename " + *filename + " declared twice");
-  filename_list.emplace_back(*filename, *prior);
-  delete filename;
-  delete prior;
+    if (it.first == filename)
+      error("model_comparison: filename " + filename + " declared twice");
+  filename_list.emplace_back(move(filename), move(prior));
 }
 
 void
@@ -2358,10 +2120,9 @@ ParsingDriver::ramsey_policy()
 }
 
 void
-ParsingDriver::add_to_ramsey_policy_list(string *name)
+ParsingDriver::add_to_ramsey_policy_list(string name)
 {
-  ramsey_policy_list.push_back(*name);
-  delete name;
+  ramsey_policy_list.push_back(move(name));
 }
 
 void
@@ -2399,19 +2160,17 @@ ParsingDriver::write_latex_steady_state_model()
 }
 
 void
-ParsingDriver::bvar_density(string *maxnlags)
+ParsingDriver::bvar_density(const string &maxnlags)
 {
-  mod_file->addStatement(new BVARDensityStatement(stoi(*maxnlags), options_list));
+  mod_file->addStatement(new BVARDensityStatement(stoi(maxnlags), options_list));
   options_list.clear();
-  delete maxnlags;
 }
 
 void
-ParsingDriver::bvar_forecast(string *nlags)
+ParsingDriver::bvar_forecast(const string &nlags)
 {
-  mod_file->addStatement(new BVARForecastStatement(stoi(*nlags), options_list));
+  mod_file->addStatement(new BVARForecastStatement(stoi(nlags), options_list));
   options_list.clear();
-  delete nlags;
 }
 
 void
@@ -2575,16 +2334,14 @@ ParsingDriver::conditional_forecast()
 }
 
 void
-ParsingDriver::plot_conditional_forecast(string *periods)
+ParsingDriver::plot_conditional_forecast(const string &periods)
 {
   int nperiods;
-  if (periods == nullptr)
+  if (periods.empty())
     nperiods = -1;
   else
-    {
-      nperiods = stoi(*periods);
-      delete periods;
-    }
+    nperiods = stoi(periods);
+
   mod_file->addStatement(new PlotConditionalForecastStatement(nperiods, symbol_list));
   symbol_list.clear();
 }
@@ -2647,28 +2404,25 @@ ParsingDriver::add_model_equal_with_zero_rhs(expr_t arg)
 }
 
 void
-ParsingDriver::declare_model_local_variable(string *name, string *tex_name)
+ParsingDriver::declare_model_local_variable(const string &name, const string &tex_name)
 {
-  declare_symbol(name, SymbolType::modelLocalVariable, tex_name, nullptr);
-  delete name;
-  if (tex_name != nullptr)
-    delete tex_name;
+  declare_symbol(name, SymbolType::modelLocalVariable, tex_name, {});
 }
 
 void
-ParsingDriver::declare_and_init_model_local_variable(string *name, expr_t rhs)
+ParsingDriver::declare_and_init_model_local_variable(const string &name, expr_t rhs)
 {
   int symb_id;
   try
     {
-      symb_id = mod_file->symbol_table.addSymbol(*name, SymbolType::modelLocalVariable);
+      symb_id = mod_file->symbol_table.addSymbol(name, SymbolType::modelLocalVariable);
     }
   catch (SymbolTable::AlreadyDeclaredException &e)
     {
       // It can have already been declared in a steady_state_model block, check that it is indeed a ModelLocalVariable
-      symb_id = mod_file->symbol_table.getID(*name);
+      symb_id = mod_file->symbol_table.getID(name);
       if (mod_file->symbol_table.getType(symb_id) != SymbolType::modelLocalVariable)
-        error(*name + " has wrong type or was already used on the right-hand side. You cannot use it on the left-hand side of a pound ('#') expression");
+        error(name + " has wrong type or was already used on the right-hand side. You cannot use it on the left-hand side of a pound ('#') expression");
     }
 
   try
@@ -2677,36 +2431,32 @@ ParsingDriver::declare_and_init_model_local_variable(string *name, expr_t rhs)
     }
   catch (DataTree::LocalVariableException &e)
     {
-      error("Local model variable " + *name + " declared twice.");
+      error("Local model variable " + name + " declared twice.");
     }
-  delete name;
 }
 
 void
-ParsingDriver::change_type(SymbolType new_type, vector<string *> *var_list)
+ParsingDriver::change_type(SymbolType new_type, const vector<string> &var_list)
 {
-  for (auto & it : *var_list)
+  for (auto & it : var_list)
     {
       int id;
       try
         {
-          id = mod_file->symbol_table.getID(*it);
+          id = mod_file->symbol_table.getID(it);
         }
       catch (SymbolTable::UnknownSymbolNameException &e)
         {
-          error("Unknown variable " + *it);
+          error("Unknown variable " + it);
         }
 
       // Check if symbol already used in a VariableNode
       if (mod_file->expressions_tree.isSymbolUsed(id)
           || mod_file->dynamic_model.isSymbolUsed(id))
-        error("You cannot modify the type of symbol " + *it + " after having used it in an expression");
+        error("You cannot modify the type of symbol " + it + " after having used it in an expression");
 
       mod_file->symbol_table.changeType(id, new_type);
-
-      delete it;
     }
-  delete var_list;
 }
 
 expr_t
@@ -2789,31 +2539,21 @@ ParsingDriver::add_power(expr_t arg1, expr_t arg2)
 }
 
 expr_t
-ParsingDriver::add_expectation(string *arg1, expr_t arg2)
+ParsingDriver::add_expectation(const string &arg1, expr_t arg2)
 {
-  expr_t expectationNode;
-  expectationNode = data_tree->AddExpectation(stoi(*arg1), arg2);
-  delete arg1;
-  return expectationNode;
+  return data_tree->AddExpectation(stoi(arg1), arg2);
 }
 
 expr_t
-ParsingDriver::add_var_expectation(string *arg1, string *arg2, string *arg3)
+ParsingDriver::add_var_expectation(const string &arg1, const string &arg2, const string &arg3)
 {
-  stringstream ss(*arg2);
-  int forecast_horizon;
-  ss >> forecast_horizon;
-  expr_t varExpectationNode = data_tree->AddVarExpectation(mod_file->symbol_table.getID(*arg1), forecast_horizon, *arg3);
-  delete arg2;
-  return varExpectationNode;
+  return data_tree->AddVarExpectation(mod_file->symbol_table.getID(arg1), stoi(arg2), arg3);
 }
 
 expr_t
-ParsingDriver::add_pac_expectation(string *var_model_name)
+ParsingDriver::add_pac_expectation(const string &var_model_name)
 {
-  expr_t pac_exp_node = data_tree->AddPacExpectation(*var_model_name);
-  delete var_model_name;
-  return pac_exp_node;
+  return data_tree->AddPacExpectation(var_model_name);
 }
 
 void
@@ -2822,26 +2562,24 @@ ParsingDriver::pac_model()
   OptionsList::string_options_t::const_iterator it = options_list.string_options.find("pac.model_name");
   if (it == options_list.string_options.end())
     error("You must pass the model_name option to the pac_model statement.");
-  const string *name = new string(it->second);
+  auto name = it->second;
 
   it = options_list.string_options.find("pac.var_model_name");
   if (it == options_list.string_options.end())
     error("You must pass the var_model_name option to the pac_model statement.");
-  const string *var_name = new string(it->second);
+  auto var_name = it->second;
 
   it = options_list.string_options.find("pac.discount");
   if (it == options_list.string_options.end())
     error("You must pass the discount option to the pac_model statement.");
-  const string *discount = new string(it->second);
+  auto discount = it->second;
 
-  string *growth;
+  string growth;
   it = options_list.string_options.find("pac.growth");
-  if (it == options_list.string_options.end())
-    growth = new string("");
-  else
-    growth = new string(it->second);
+  if (it != options_list.string_options.end())
+    growth = it->second;
 
-  mod_file->addStatement(new PacModelStatement(*name, *var_name, *discount, *growth, pac_undiff, mod_file->symbol_table));
+  mod_file->addStatement(new PacModelStatement(name, var_name, discount, growth, pac_undiff, mod_file->symbol_table));
 
   symbol_list.clear();
   options_list.clear();
@@ -2849,11 +2587,9 @@ ParsingDriver::pac_model()
 }
 
 void
-ParsingDriver::pac_model_undiff(string *eqtag, string *order)
+ParsingDriver::pac_model_undiff(string eqtag, const string &order)
 {
-  pac_undiff[*eqtag] = stoi(*order);
-  delete eqtag;
-  delete order;
+  pac_undiff[move(eqtag)] = stoi(order);
 }
 
 expr_t
@@ -2869,32 +2605,24 @@ ParsingDriver::add_diff(expr_t arg1)
 }
 
 expr_t
-ParsingDriver::add_adl(expr_t arg1, string *name, string *lag)
+ParsingDriver::add_adl(expr_t arg1, const string &name, const string &lag)
 {
-  auto *lags = new vector<int>();
-  for (int i = 1; i <= stoi(*lag); i++)
-    lags->push_back(i);
-
-  delete lag;
+  vector<int> lags;
+  for (int i = 1; i <= stoi(lag); i++)
+    lags.push_back(i);
 
   return add_adl(arg1, name, lags);
 }
 
 expr_t
-ParsingDriver::add_adl(expr_t arg1, string *name, vector<int> *lags)
+ParsingDriver::add_adl(expr_t arg1, const string &name, const vector<int> &lags)
 {
-  expr_t id = data_tree->AddAdl(arg1, *name, *lags);
+  expr_t id = data_tree->AddAdl(arg1, name, lags);
 
   // Declare parameters here so that parameters can be initialized after the model block
-  for (vector<int>::const_iterator it = lags->begin(); it != lags->end(); it++)
-    {
-      ostringstream inttostr;
-      inttostr << *it;
-      declare_parameter(new string(*name + "_lag_" + inttostr.str()));
-    }
+  for (auto i : lags)
+    declare_parameter(name + "_lag_" + to_string(i));
 
-  delete name;
-  delete lags;
   return id;
 }
 
@@ -3048,13 +2776,6 @@ ParsingDriver::add_steady_state(expr_t arg1)
   return data_tree->AddSteadyState(arg1);
 }
 
-void
-ParsingDriver::external_function_option(const string &name_option, string *opt)
-{
-  external_function_option(name_option, *opt);
-  delete opt;
-}
-
 void
 ParsingDriver::external_function_option(const string &name_option, const string &opt)
 {
@@ -3062,7 +2783,7 @@ ParsingDriver::external_function_option(const string &name_option, const string
     {
       if (opt.empty())
         error("An argument must be passed to the 'name' option of the external_function() statement.");
-      declare_symbol(&opt, SymbolType::externalFunction, nullptr, nullptr);
+      declare_symbol(opt, SymbolType::externalFunction, "", {});
       current_external_function_id = mod_file->symbol_table.getID(opt);
     }
   else if (name_option == "first_deriv_provided")
@@ -3071,7 +2792,7 @@ ParsingDriver::external_function_option(const string &name_option, const string
         current_external_function_options.firstDerivSymbID = eExtFunSetButNoNameProvided;
       else
         {
-          declare_symbol(&opt, SymbolType::externalFunction, nullptr, nullptr);
+          declare_symbol(opt, SymbolType::externalFunction, "", {});
           current_external_function_options.firstDerivSymbID = mod_file->symbol_table.getID(opt);
         }
     }
@@ -3081,7 +2802,7 @@ ParsingDriver::external_function_option(const string &name_option, const string
         current_external_function_options.secondDerivSymbID = eExtFunSetButNoNameProvided;
       else
         {
-          declare_symbol(&opt, SymbolType::externalFunction, nullptr, nullptr);
+          declare_symbol(opt, SymbolType::externalFunction, "", {});
           current_external_function_options.secondDerivSymbID = mod_file->symbol_table.getID(opt);
         }
     }
@@ -3168,46 +2889,45 @@ ParsingDriver::is_there_one_integer_argument() const
 }
 
 expr_t
-ParsingDriver::add_model_var_or_external_function(string *function_name, bool in_model_block)
+ParsingDriver::add_model_var_or_external_function(const string &function_name, bool in_model_block)
 {
   expr_t nid;
-  if (mod_file->symbol_table.exists(*function_name))
-    if (mod_file->symbol_table.getType(*function_name) != SymbolType::externalFunction)
+  if (mod_file->symbol_table.exists(function_name))
+    if (mod_file->symbol_table.getType(function_name) != SymbolType::externalFunction)
       if (!in_model_block)
         {
           if (stack_external_function_args.top().size() > 0)
-            error(string("Symbol ") + *function_name + string(" cannot take arguments."));
+            error(string("Symbol ") + function_name + string(" cannot take arguments."));
           else
             return add_expression_variable(function_name);
         }
       else
         { // e.g. model_var(lag) => ADD MODEL VARIABLE WITH LEAD (NumConstNode)/LAG (UnaryOpNode)
-          if (undeclared_model_vars.find(*function_name) != undeclared_model_vars.end())
-            undeclared_model_variable_error("Unknown symbol: " + *function_name, *function_name);
+          if (undeclared_model_vars.find(function_name) != undeclared_model_vars.end())
+            undeclared_model_variable_error("Unknown symbol: " + function_name, function_name);
 
           pair<bool, double> rv = is_there_one_integer_argument();
           if (!rv.first)
-            model_error("Symbol " + *function_name +
+            model_error("Symbol " + function_name +
                         " is being treated as if it were a function (i.e., takes an argument that is not an integer).", "");
 
-          nid = add_model_variable(mod_file->symbol_table.getID(*function_name), (int) rv.second);
+          nid = add_model_variable(mod_file->symbol_table.getID(function_name), (int) rv.second);
           stack_external_function_args.pop();
-          delete function_name;
           return nid;
       }
     else
       { // e.g. this function has already been referenced (either ad hoc or through the external_function() statement
         // => check that the information matches previously declared info
-        int symb_id = mod_file->symbol_table.getID(*function_name);
+        int symb_id = mod_file->symbol_table.getID(function_name);
         if (!mod_file->external_functions_table.exists(symb_id))
-          error("Using a derivative of an external function (" + *function_name + ") in the model block is currently not allowed.");
+          error("Using a derivative of an external function (" + function_name + ") in the model block is currently not allowed.");
 
         if (in_model_block)
           if (mod_file->external_functions_table.getNargs(symb_id) == eExtFunNotSet)
-            error("Before using " + *function_name
+            error("Before using " + function_name
                   +"() in the model block, you must first declare it via the external_function() statement");
           else if ((int) (stack_external_function_args.top().size()) != mod_file->external_functions_table.getNargs(symb_id))
-            error("The number of arguments passed to " + *function_name
+            error("The number of arguments passed to " + function_name
                   +"() does not match those of a previous call or declaration of this function.");
       }
   else
@@ -3216,32 +2936,31 @@ ParsingDriver::add_model_var_or_external_function(string *function_name, bool in
         {
           // Continue processing, noting that it was not declared
           // Processing will end at the end of the model block if nostrict was not passed
-          undeclared_model_vars.insert(*function_name);
-          undeclared_model_variable_error("Unknown symbol: " + *function_name, *function_name);
+          undeclared_model_vars.insert(function_name);
+          undeclared_model_variable_error("Unknown symbol: " + function_name, function_name);
 
           pair<bool, double> rv = is_there_one_integer_argument();
           if (rv.first)
             {
               // assume it's a lead/lagged variable
-              declare_exogenous(new string(*function_name));
-              return add_model_variable(mod_file->symbol_table.getID(*function_name), (int) rv.second);
+              declare_exogenous(function_name);
+              return add_model_variable(mod_file->symbol_table.getID(function_name), (int) rv.second);
             }
           else
-            error("To use an external function (" + *function_name +
+            error("To use an external function (" + function_name +
                   ") within the model block, you must first declare it via the external_function() statement.");
         }
-      declare_symbol(function_name, SymbolType::externalFunction, nullptr, nullptr);
+      declare_symbol(function_name, SymbolType::externalFunction, "", {});
       current_external_function_options.nargs = stack_external_function_args.top().size();
-      mod_file->external_functions_table.addExternalFunction(mod_file->symbol_table.getID(*function_name),
+      mod_file->external_functions_table.addExternalFunction(mod_file->symbol_table.getID(function_name),
                                                              current_external_function_options, in_model_block);
       reset_current_external_function_options();
     }
 
   //By this point, we're sure that this function exists in the External Functions Table and is not a mod var
-  int symb_id = mod_file->symbol_table.getID(*function_name);
+  int symb_id = mod_file->symbol_table.getID(function_name);
   nid = data_tree->AddExternalFunction(symb_id, stack_external_function_args.top());
   stack_external_function_args.pop();
-  delete function_name;
   return nid;
 }
 
@@ -3252,9 +2971,8 @@ ParsingDriver::add_native(const string &s)
 }
 
 void
-ParsingDriver::add_native_remove_charset(const char *s, const string &token)
+ParsingDriver::add_native_remove_charset(string str, const string &token)
 {
-  string str = string(s);
   size_t found = str.find(token);
 
   assert(found != string::npos);
@@ -3269,9 +2987,8 @@ ParsingDriver::add_verbatim(const string &s)
 }
 
 void
-ParsingDriver::add_verbatim_remove_charset(const char *s, const string &token)
+ParsingDriver::add_verbatim_remove_charset(string str, const string &token)
 {
-  string str = string(s);
   size_t found = str.find(token);
 
   assert(found != string::npos);
@@ -3286,26 +3003,24 @@ ParsingDriver::begin_steady_state_model()
 }
 
 void
-ParsingDriver::add_steady_state_model_equal(string *varname, expr_t expr)
+ParsingDriver::add_steady_state_model_equal(const string &varname, expr_t expr)
 {
   int id;
   try
     {
-      id = mod_file->symbol_table.getID(*varname);
+      id = mod_file->symbol_table.getID(varname);
     }
   catch (SymbolTable::UnknownSymbolNameException &e)
     {
       // Unknown symbol, declare it as a ModFileLocalVariable
-      id = mod_file->symbol_table.addSymbol(*varname, SymbolType::modFileLocalVariable);
+      id = mod_file->symbol_table.addSymbol(varname, SymbolType::modFileLocalVariable);
     }
 
   SymbolType type = mod_file->symbol_table.getType(id);
   if (type != SymbolType::endogenous && type != SymbolType::modFileLocalVariable && type != SymbolType::parameter)
-    error(*varname + " has incorrect type");
+    error(varname + " has incorrect type");
 
   mod_file->steady_state_model.addDefinition(id, expr);
-
-  delete varname;
 }
 
 void
@@ -3364,38 +3079,30 @@ ParsingDriver::model_diagnostics()
 }
 
 void
-ParsingDriver::add_parallel_local_file(string *filename)
+ParsingDriver::add_parallel_local_file(string filename)
 {
-  mod_file->parallel_local_files.push_back(*filename);
-  delete filename;
+  mod_file->parallel_local_files.push_back(move(filename));
 }
 
 void
-ParsingDriver::add_moment_calibration_item(string *endo1, string *endo2, string *lags, vector<string *> *range)
+ParsingDriver::add_moment_calibration_item(const string &endo1, const string &endo2, string lags, const pair<string, string> &range)
 {
   MomentCalibration::Constraint c;
 
-  check_symbol_existence(*endo1);
-  c.endo1 = mod_file->symbol_table.getID(*endo1);
-  if (mod_file->symbol_table.getType(*endo1) != SymbolType::endogenous)
-    error("Variable " + *endo1 + " is not an endogenous.");
-  delete endo1;
+  check_symbol_existence(endo1);
+  c.endo1 = mod_file->symbol_table.getID(endo1);
+  if (mod_file->symbol_table.getType(endo1) != SymbolType::endogenous)
+    error("Variable " + endo1 + " is not an endogenous.");
 
-  check_symbol_existence(*endo2);
-  c.endo2 = mod_file->symbol_table.getID(*endo2);
-  if (mod_file->symbol_table.getType(*endo2) != SymbolType::endogenous)
-    error("Variable " + *endo2 + " is not an endogenous.");
-  delete endo2;
+  check_symbol_existence(endo2);
+  c.endo2 = mod_file->symbol_table.getID(endo2);
+  if (mod_file->symbol_table.getType(endo2) != SymbolType::endogenous)
+    error("Variable " + endo2 + " is not an endogenous.");
 
-  c.lags = *lags;
-  delete lags;
+  c.lags = move(lags);
 
-  assert(range->size() == 2);
-  c.lower_bound = *((*range)[0]);
-  c.upper_bound = *((*range)[1]);
-  delete (*range)[0];
-  delete (*range)[1];
-  delete range;
+  c.lower_bound = range.first;
+  c.upper_bound = range.second;
 
   moment_calibration_constraints.push_back(c);
 }
@@ -3409,31 +3116,24 @@ ParsingDriver::end_moment_calibration()
 }
 
 void
-ParsingDriver::add_irf_calibration_item(string *endo, string *periods, string *exo, vector<string *> *range)
+ParsingDriver::add_irf_calibration_item(const string &endo, string periods, const string &exo, const pair<string, string> &range)
 {
   IrfCalibration::Constraint c;
 
-  check_symbol_existence(*endo);
-  c.endo = mod_file->symbol_table.getID(*endo);
-  if (mod_file->symbol_table.getType(*endo) != SymbolType::endogenous)
-    error("Variable " + *endo + " is not an endogenous.");
-  delete endo;
+  check_symbol_existence(endo);
+  c.endo = mod_file->symbol_table.getID(endo);
+  if (mod_file->symbol_table.getType(endo) != SymbolType::endogenous)
+    error("Variable " + endo + " is not an endogenous.");
 
-  c.periods = *periods;
-  delete periods;
+  c.periods = move(periods);
 
-  check_symbol_existence(*exo);
-  c.exo = mod_file->symbol_table.getID(*exo);
-  if (mod_file->symbol_table.getType(*exo) != SymbolType::exogenous)
-    error("Variable " + *endo + " is not an exogenous.");
-  delete exo;
+  check_symbol_existence(exo);
+  c.exo = mod_file->symbol_table.getID(exo);
+  if (mod_file->symbol_table.getType(exo) != SymbolType::exogenous)
+    error("Variable " + endo + " is not an exogenous.");
 
-  assert(range->size() == 2);
-  c.lower_bound = *((*range)[0]);
-  c.upper_bound = *((*range)[1]);
-  delete (*range)[0];
-  delete (*range)[1];
-  delete range;
+  c.lower_bound = range.first;
+  c.upper_bound = range.second;
 
   irf_calibration_constraints.push_back(c);
 }
@@ -3455,10 +3155,9 @@ ParsingDriver::smoother2histval()
 }
 
 void
-ParsingDriver::histval_file(string *filename)
+ParsingDriver::histval_file(const string &filename)
 {
-  mod_file->addStatement(new HistvalFileStatement(*filename));
-  delete filename;
+  mod_file->addStatement(new HistvalFileStatement(filename));
 }
 
 void
@@ -3506,68 +3205,64 @@ ParsingDriver::add_ramsey_constraints_statement()
 }
 
 void
-ParsingDriver::ramsey_constraint_add_less(const string *name, const expr_t rhs)
+ParsingDriver::ramsey_constraint_add_less(const string &name, const expr_t rhs)
 {
   add_ramsey_constraint(name, BinaryOpcode::less, rhs);
 }
 
 void
-ParsingDriver::ramsey_constraint_add_greater(const string *name, const expr_t rhs)
+ParsingDriver::ramsey_constraint_add_greater(const string &name, const expr_t rhs)
 {
   add_ramsey_constraint(name, BinaryOpcode::greater, rhs);
 }
 
 void
-ParsingDriver::ramsey_constraint_add_less_equal(const string *name, const expr_t rhs)
+ParsingDriver::ramsey_constraint_add_less_equal(const string &name, const expr_t rhs)
 {
   add_ramsey_constraint(name, BinaryOpcode::lessEqual, rhs);
 }
 
 void
-ParsingDriver::ramsey_constraint_add_greater_equal(const string *name, const expr_t rhs)
+ParsingDriver::ramsey_constraint_add_greater_equal(const string &name, const expr_t rhs)
 {
   add_ramsey_constraint(name, BinaryOpcode::greaterEqual, rhs);
 }
 
 void
-ParsingDriver::add_ramsey_constraint(const string *name, BinaryOpcode op_code, const expr_t rhs)
+ParsingDriver::add_ramsey_constraint(const string &name, BinaryOpcode op_code, const expr_t rhs)
 {
-  check_symbol_existence(*name);
-  int symb_id = mod_file->symbol_table.getID(*name);
+  check_symbol_existence(name);
+  int symb_id = mod_file->symbol_table.getID(name);
   SymbolType type = mod_file->symbol_table.getType(symb_id);
 
   if (type != SymbolType::endogenous)
-    error("ramsey_constraints: " + *name + " should be an endogenous variable");
+    error("ramsey_constraints: " + name + " should be an endogenous variable");
 
   RamseyConstraintsStatement::Constraint C;
   C.endo = symb_id;
   C.code = op_code;
   C.expression = rhs;
   ramsey_constraints.push_back(C);
-
-  delete name;
 }
 
 void
-ParsingDriver::add_shock_group_element(string *name)
+ParsingDriver::add_shock_group_element(string name)
 {
-  check_symbol_existence(*name);
-  int symb_id = mod_file->symbol_table.getID(*name);
+  check_symbol_existence(name);
+  int symb_id = mod_file->symbol_table.getID(name);
   SymbolType type = mod_file->symbol_table.getType(symb_id);
 
   if (type != SymbolType::exogenous)
-    error("shock_groups: " + *name + " should be an exogenous variable");
-
-  shock_group.push_back(*name);
+    error("shock_groups: " + name + " should be an exogenous variable");
 
-  delete name;
+  shock_group.push_back(move(name));
 }
 
 void
-ParsingDriver::add_shock_group(string *name)
+ParsingDriver::add_shock_group(string name)
 {
   ShockGroupsStatement::Group G;
-  G.name = *name;
+  G.name = move(name);
   G.list = shock_group;
   shock_groups.push_back(G);
 
@@ -3575,8 +3270,8 @@ ParsingDriver::add_shock_group(string *name)
 }
 
 void
-ParsingDriver::end_shock_groups(const string *name)
+ParsingDriver::end_shock_groups(const string &name)
 {
-  mod_file->addStatement(new ShockGroupsStatement(shock_groups, *name));
+  mod_file->addStatement(new ShockGroupsStatement(shock_groups, name));
   shock_groups.clear();
 }
diff --git a/src/ParsingDriver.hh b/src/ParsingDriver.hh
index 043099e203f95643e45f11a62a66936a8f443ba4..8a4ebb30de4c73e7614957c4ca1cdaacae1a6ca3 100644
--- a/src/ParsingDriver.hh
+++ b/src/ParsingDriver.hh
@@ -85,23 +85,23 @@ private:
   void check_symbol_existence(const string &name);
 
   //! Checks that a given symbol exists and is a parameter, and stops with an error message if it isn't
-  void check_symbol_is_parameter(string *name);
+  void check_symbol_is_parameter(const string &name);
 
   //! Checks that a given symbol was assigned within a Statement
-  void check_symbol_is_statement_variable(string *name);
+  void check_symbol_is_statement_variable(const string &name);
 
   //! Checks that a given symbol exists and is a endogenous or exogenous, and stops with an error message if it isn't
-  void check_symbol_is_endogenous_or_exogenous(string *name);
+  void check_symbol_is_endogenous_or_exogenous(const string &name);
 
   //! Checks that a given symbol exists and is a exogenous, and stops with an error message if it isn't
-  void check_symbol_is_exogenous(string *name);
+  void check_symbol_is_exogenous(const string &name);
 
   //! Checks for symbol existence in model block. If it doesn't exist, an error message is stored to be printed at
   //! the end of the model block
   void check_symbol_existence_in_model_block(const string &name);
 
   //! Helper to add a symbol declaration
-  void declare_symbol(const string *name, SymbolType type, const string *tex_name, const vector<pair<string *, string *> *> *partition_value);
+  void declare_symbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string, string>> &partition_value);
 
   //! Creates option "optim_opt" in OptionsList if it doesn't exist, else add a comma, and adds the option name
   void optim_options_helper(const string &name);
@@ -306,7 +306,7 @@ public:
   void create_error_string(const Dynare::parser::location_type &l, const string &m, ostream &stream);
 
   //! Check if a given symbol exists in the parsing context, and is not a mod file local variable
-  bool symbol_exists_and_is_not_modfile_local_or_external_function(const char *s);
+  bool symbol_exists_and_is_not_modfile_local_or_external_function(const string &s);
   //! Sets mode of ModelTree class to use C output
   void use_dll();
   //! the modelis block decomposed
@@ -320,72 +320,72 @@ public:
   //! the differentiate_forward_vars option is enabled (for a subset of vars)
   void differentiate_forward_vars_some();
   //! cutoff option of model block
-  void cutoff(string *value);
+  void cutoff(const string &value);
   //! mfs option of model block
-  void mfs(string *value);
+  void mfs(const string &value);
   //! Sets the FILENAME for the initial value in initval
-  void initval_file(string *filename);
+  void initval_file(const string &filename);
   //! Declares an endogenous variable
-  void declare_endogenous(string *name, string *tex_name = nullptr, vector<pair<string *, string *> *> *partition_value = nullptr);
+  void declare_endogenous(const string &name, const string &tex_name = "", const vector<pair<string, string>> &partition_value = {});
   //! Declares an exogenous variable
-  void declare_exogenous(string *name, string *tex_name = nullptr, vector<pair<string *, string *> *> *partition_value = nullptr);
+  void declare_exogenous(const string &name, const string &tex_name = "", const vector<pair<string, string>> &partition_value = {});
   //! Declares an exogenous deterministic variable
-  void declare_exogenous_det(string *name, string *tex_name = nullptr, vector<pair<string *, string *> *> *partition_value = nullptr);
+  void declare_exogenous_det(const string &name, const string &tex_name = "", const vector<pair<string, string>> &partition_value = {});
   //! Declares a parameter
-  void declare_parameter(string *name, string *tex_name = nullptr, vector<pair<string *, string *> *> *partition_value = nullptr);
+  void declare_parameter(const string &name, const string &tex_name = "", const vector<pair<string, string>> &partition_value = {});
   //! Declares a VAR variable and adds to symbol_list
-  void declare_var_endogenous(string *name);
+  void declare_var_endogenous(const string &name);
   //! Declares a model local variable
-  void declare_model_local_variable(string *name, string *tex_name = nullptr);
+  void declare_model_local_variable(const string &name, const string &tex_name = "");
   //! Declares a statement local variable
-  void declare_statement_local_variable(string *name);
+  void declare_statement_local_variable(const string &name);
   //! Completes a subsample statement
-  void set_subsamples(string *name1, string *name2);
+  void set_subsamples(string name1, string name2);
   //! Declares a subsample, assigning the value to name
-  void set_subsample_name_equal_to_date_range(string *name, string *date1, string *date2);
+  void set_subsample_name_equal_to_date_range(string name, string date1, string date2);
   //! Checks that a subsample statement (and given name) were provided for the pair name1 & name2
-  void check_subsample_declaration_exists(string *name1, string *subsample_name);
-  void check_subsample_declaration_exists(string *name1, string *name2, string *subsample_name);
+  void check_subsample_declaration_exists(const string &name1, const string &subsample_name);
+  void check_subsample_declaration_exists(const string &name1, const string &name2, const string &subsample_name);
   //! Copies the set of subsamples from_name to_name
-  void copy_subsamples(string *to_name1, string *to_name2, string *from_name1, string *from_name2);
+  void copy_subsamples(string to_name1, string to_name2, string from_name1, string from_name2);
   //! Declares declare_optimal_policy_discount_factor as a parameter and initializes it to exprnode
   void declare_optimal_policy_discount_factor_parameter(expr_t exprnode);
   //! Adds a predetermined_variable
-  void add_predetermined_variable(string *name);
+  void add_predetermined_variable(const string &name);
   //! Declares and initializes a local parameter
-  void declare_and_init_model_local_variable(string *name, expr_t rhs);
+  void declare_and_init_model_local_variable(const string &name, expr_t rhs);
   //! Changes type of a symbol
-  void change_type(SymbolType new_type, vector<string *> *var_list);
+  void change_type(SymbolType new_type, const vector<string> &var_list);
   //! Adds a list of tags for the current equation
-  void add_equation_tags(string *key, string *value);
+  void add_equation_tags(string key, string value);
   //! Adds a non-negative constant to DataTree
-  expr_t add_non_negative_constant(string *constant);
+  expr_t add_non_negative_constant(const string &constant);
   //! Adds a NaN constant to DataTree
   expr_t add_nan_constant();
   //! Adds an Inf constant to DataTree
   expr_t add_inf_constant();
   //! Adds a model variable to ModelTree and VariableTable
-  expr_t add_model_variable(string *name);
+  expr_t add_model_variable(const string &name);
   //! Declares a variable of type new_type OR changes a variable in the equations to type new_type
   //! and removes any error messages that may have been issued in model_errors
-  expr_t declare_or_change_type(SymbolType new_type, string *name);
+  expr_t declare_or_change_type(SymbolType new_type, const string &name);
   //! Adds an Expression's variable
-  expr_t add_expression_variable(string *name);
+  expr_t add_expression_variable(const string &name);
   //! Adds a "periods" statement
-  void periods(string *periods);
+  void periods(const string &periods);
   //! Adds a "dsample" statement
-  void dsample(string *arg1);
+  void dsample(const string &arg1);
   //! Adds a "dsample" statement
-  void dsample(string *arg1, string *arg2);
+  void dsample(const string &arg1, const string &arg2);
   //! Writes parameter intitialisation expression
-  void init_param(string *name, expr_t rhs);
+  void init_param(const string &name, expr_t rhs);
   //! Writes an initval block
-  void init_val(string *name, expr_t rhs);
+  void init_val(const string &name, expr_t rhs);
   //! Writes an histval block
-  void hist_val(string *name, string *lag, expr_t rhs);
+  void hist_val(const string &name, const string &lag, expr_t rhs);
   //! Adds an entry in a homotopy_setup block
   /*! Second argument "val1" can be NULL if no initial value provided */
-  void homotopy_val(string *name, expr_t val1, expr_t val2);
+  void homotopy_val(const string &name, expr_t val1, expr_t val2);
   //! Writes end of an initval block
   void end_initval(bool all_values_required);
   //! Writes end of an endval block
@@ -403,58 +403,52 @@ public:
   //! Writes a mshocks statement
   void end_mshocks(bool overwrite);
   //! Adds a deterministic shock or a path element inside a conditional_forecast_paths block
-  void add_det_shock(string *var, bool conditional_forecast);
+  void add_det_shock(const string &var, bool conditional_forecast);
   //! Adds a std error chock
-  void add_stderr_shock(string *var, expr_t value);
+  void add_stderr_shock(const string &var, expr_t value);
   //! Adds a variance chock
-  void add_var_shock(string *var, expr_t value);
+  void add_var_shock(const string &var, expr_t value);
   //! Adds a covariance chock
-  void add_covar_shock(string *var1, string *var2, expr_t value);
+  void add_covar_shock(const string &var1, const string &var2, expr_t value);
   //! Adds a correlated chock
-  void add_correl_shock(string *var1, string *var2, expr_t value);
+  void add_correl_shock(const string &var1, const string &var2, expr_t value);
   //! Adds a shock period range
-  void add_period(string *p1, string *p2);
+  void add_period(const string &p1, const string &p2);
   //! Adds a shock period
-  void add_period(string *p1);
+  void add_period(const string &p1);
   //! Adds a deterministic shock value
   void add_value(expr_t value);
   //! Adds a deterministic shock value
   /*! \param v a string containing a (possibly negative) numeric constant */
-  void add_value(string *v);
+  void add_value(const string &v);
   //! Writes a Sigma_e block
   void do_sigma_e();
   //! Ends row of Sigma_e block
   void end_of_row();
   //! Adds a constant element to current row of Sigma_e
-  void add_to_row_const(string *v);
+  void add_to_row_const(const string &v);
   //! Adds an expression element to current row of Sigma_e
   void add_to_row(expr_t v);
   //! Write a steady command
   void steady();
   //! Sets an option to a numerical value
-  void option_num(const string &name_option, string *opt);
+  void option_num(string name_option, string opt);
   //! Sets an option to a numerical value
-  void option_num(const string &name_option, const string &opt);
-  //! Sets an option to a numerical value
-  void option_num(const string &name_option, string *opt1, string *opt2);
-  //! Sets an option to a string value
-  void option_str(const string &name_option, string *opt);
+  void option_num(string name_option, string opt1, string opt2);
   //! Sets an option to a string value
-  void option_str(const string &name_option, const string &opt);
+  void option_str(string name_option, string opt);
   //! Sets an option to a date value
-  void option_date(const string &name_option, string *opt);
-  //! Sets an option to a date value
-  void option_date(const string &name_option, const string &opt);
+  void option_date(string name_option, string opt);
   //! Sets an option to a list of symbols (used in conjunction with add_in_symbol_list())
-  void option_symbol_list(const string &name_option);
+  void option_symbol_list(string name_option);
   //! Sets an option to a vector of integers
-  void option_vec_int(const string &name_option, const vector<int> *opt);
+  void option_vec_int(string name_option, vector<int> opt);
   //! Sets an option to a vector of strings
-  void option_vec_str(const string &name_option, const vector<string> *opt);
+  void option_vec_str(string name_option, vector<string> opt);
   //! Indicates that the model is linear
   void linear();
   //! Adds a variable to temporary symbol list
-  void add_in_symbol_list(string *tmp_var);
+  void add_in_symbol_list(const string &tmp_var);
   //! Writes a rplot() command
   void rplot();
   //! Writes a stock_simul command
@@ -476,8 +470,6 @@ public:
   //! Adds a declaration for a user-defined external function
   void external_function();
   //! Sets an external_function option to a string value
-  void external_function_option(const string &name_option, string *opt);
-  //! Sets an external_function option to a string value
   void external_function_option(const string &name_option, const string &opt);
   //! Add a line in an estimated params block
   void add_estimated_params_element();
@@ -486,78 +478,78 @@ public:
   //! Add a line in an osr params block
   void add_osr_params_element();
   //! Sets the frequency of the data
-  void set_time(string *arg);
+  void set_time(const string &arg);
   //! Estimation Data
   void estimation_data();
   //! Sets the prior for a parameter
-  void set_prior(string *arg1, string *arg2);
+  void set_prior(const string &name, const string &subsample_name);
   //! Sets the joint prior for a set of parameters
-  void set_joint_prior(vector<string *> *symbol_vec);
+  void set_joint_prior(const vector<string> &symbol_vec);
   //! Adds a parameters to the list of joint parameters
-  void add_joint_parameter(string *name);
+  void add_joint_parameter(string name);
   //! Adds the variance option to its temporary holding place
   void set_prior_variance(expr_t variance = nullptr);
   //! Copies the prior from_name to_name
-  void copy_prior(string *to_declaration_type, string *to_name1, string *to_name2, string *to_subsample_name,
-                  string *from_declaration_type, string *from_name1, string *from_name2, string *from_subsample_name);
+  void copy_prior(const string &to_declaration_type, const string &to_name1, const string &to_name2, const string &to_subsample_name,
+                  const string &from_declaration_type, const string &from_name1, const string &from_name2, const string &from_subsample_name);
   //! Sets the options for a parameter
-  void set_options(string *arg1, string *arg2);
+  void set_options(const string &name, const string &subsample_name);
   //! Copies the options from_name to_name
-  void copy_options(string *to_declaration_type, string *to_name1, string *to_name2, string *to_subsample_name,
-                    string *from_declaration_type, string *from_name1, string *from_name2, string *from_subsample_name);
+  void copy_options(const string &to_declaration_type, const string &to_name1, const string &to_name2, const string &to_subsample_name,
+                  const string &from_declaration_type, const string &from_name1, const string &from_name2, const string &from_subsample_name);
   //! Sets the prior for estimated std dev
-  void set_std_prior(string *arg1, string *arg2);
+  void set_std_prior(const string &name, const string &subsample_name);
   //! Sets the options for estimated std dev
-  void set_std_options(string *arg1, string *arg2);
+  void set_std_options(const string &name, const string &subsample_name);
   //! Sets the prior for estimated correlation
-  void set_corr_prior(string *arg1, string *arg2, string *arg3);
+  void set_corr_prior(const string &name1, const string &name2, const string &subsample_name);
   //! Sets the options for estimated correlation
-  void set_corr_options(string *arg1, string *arg2, string *arg3);
+  void set_corr_options(const string &name1, const string &name2, const string &subsample_name);
   //! Runs estimation process
   void run_estimation();
   //! Runs dynare_sensitivy()
   void dynare_sensitivity();
   //! Adds an optimization option (string value)
-  void optim_options_string(string *name, string *value);
+  void optim_options_string(const string &name, const string &value);
   //! Adds an optimization option (numeric value)
-  void optim_options_num(string *name, string *value);
+  void optim_options_num(const string &name, const string &value);
   //! Adds an sampling option (string value)
-  void sampling_options_string(string *name, string *value);
+  void sampling_options_string(const string &name, const string &value);
   //! Adds an sampling option (numeric value)
-  void sampling_options_num(string *name, string *value);
+  void sampling_options_num(const string &name, const string &value);
   //! Check that no observed variable has yet be defined
   void check_varobs();
   //! Add a new observed variable
-  void add_varobs(string *name);
+  void add_varobs(const string &name);
   //! Check that no observed exogenous variable has yet be defined
   void check_varexobs();
   //! Add a new observed exogenous variable
-  void add_varexobs(string *name);
+  void add_varexobs(const string &name);
   //! Svar_Identification Statement
   void begin_svar_identification();
   void end_svar_identification();
   //! Svar_Identification Statement: match list of restrictions and equation number with lag
-  void combine_lag_and_restriction(string *lag);
+  void combine_lag_and_restriction(const string &lag);
   //! Svar_Identification Statement: match list of restrictions with equation number
-  void add_restriction_in_equation(string *equation);
+  void add_restriction_in_equation(const string &equation);
   //! Svar_Identification Statement: add list of restriction symbol ids
-  void add_in_svar_restriction_symbols(string *name);
+  void add_in_svar_restriction_symbols(const string &tmp_var);
   //! Svar_Identification Statement: add exclusions of constants
   void add_constants_exclusion();
   //! Svar_Identification Statement: add equation number for following restriction equations
-  void add_restriction_equation_nbr(string *eq_nbr);
+  void add_restriction_equation_nbr(const string &eq_nbr);
   //! Svar_Identification Statement: record presence of equal sign
   void add_restriction_equal();
   //! Svar_Idenditification Statement: add coefficient of a linear restriction (positive value)
-  void add_positive_restriction_element(expr_t value, string *variable, string *lag);
+  void add_positive_restriction_element(expr_t value, const string &variable, const string &lag);
   //! Svar_Idenditification Statement: add unit coefficient of a linear restriction
-  void add_positive_restriction_element(string *variable, string *lag);
+  void add_positive_restriction_element(const string &variable, const string &lag);
   //! Svar_Idenditification Statement: add coefficient of a linear restriction (negative value)
-  void add_negative_restriction_element(expr_t value, string *variable, string *lag);
+  void add_negative_restriction_element(expr_t value, const string &variable, const string &lag);
   //! Svar_Idenditification Statement: add negative unit coefficient of a linear restriction
-  void add_negative_restriction_element(string *variable, string *lag);
+  void add_negative_restriction_element(const string &variable, const string &lag);
   //! Svar_Idenditification Statement: add restriction element
-  void add_restriction_element(expr_t value, string *variable, string *lag);
+  void add_restriction_element(expr_t value, const string &variable, const string &lag);
   //! Svar_Identification Statement: check that restriction is homogenous
   void check_restriction_expression_constant(expr_t value);
   //! Svar_Identification Statement: restriction of form upper cholesky
@@ -568,24 +560,24 @@ public:
   void add_svar_global_identification_check();
   //! generate_irfs Block
   void end_generate_irfs();
-  void add_generate_irfs_element(string *name);
-  void add_generate_irfs_exog_element(string *exo, string *value);
+  void add_generate_irfs_element(string name);
+  void add_generate_irfs_exog_element(string exo, const string &value);
   //! Forecast Statement
   void forecast();
   void set_trends();
-  void set_trend_element(string *arg1, expr_t arg2);
+  void set_trend_element(string arg1, expr_t arg2);
   void set_unit_root_vars();
   void optim_weights();
-  void set_optim_weights(string *name, expr_t value);
-  void set_optim_weights(string *name1, string *name2, expr_t value);
+  void set_optim_weights(string name, expr_t value);
+  void set_optim_weights(const string &name1, const string &name2, expr_t value);
   void set_osr_params();
   void run_osr();
-  void run_dynasave(string *filename);
-  void run_dynatype(string *filename);
-  void run_load_params_and_steady_state(string *filename);
-  void run_save_params_and_steady_state(string *filename);
+  void run_dynasave(const string &filename);
+  void run_dynatype(const string &filename);
+  void run_load_params_and_steady_state(const string &filename);
+  void run_save_params_and_steady_state(const string &filename);
   void run_identification();
-  void add_mc_filename(string *filename, string *prior = new string ("1"));
+  void add_mc_filename(string filename, string prior = "1");
   void run_model_comparison();
   //! Begin a planner_objective statement
   void begin_planner_objective();
@@ -596,15 +588,15 @@ public:
   //! Ramsey constraints statement
   void add_ramsey_constraints_statement();
   //! Ramsey less constraint
-  void ramsey_constraint_add_less(const string *name, const expr_t rhs);
+  void ramsey_constraint_add_less(const string &name, const expr_t rhs);
   //! Ramsey greater constraint
-  void ramsey_constraint_add_greater(const string *name, const expr_t rhs);
+  void ramsey_constraint_add_greater(const string &name, const expr_t rhs);
   //! Ramsey less or equal constraint
-  void ramsey_constraint_add_less_equal(const string *name, const expr_t rhs);
+  void ramsey_constraint_add_less_equal(const string &name, const expr_t rhs);
   //! Ramsey greater or equal constraint
-  void ramsey_constraint_add_greater_equal(const string *name, const expr_t rhs);
+  void ramsey_constraint_add_greater_equal(const string &name, const expr_t rhs);
   //! Ramsey constraint helper function
-  void add_ramsey_constraint(const string *name, BinaryOpcode op_code, const expr_t rhs);
+  void add_ramsey_constraint(const string &name, BinaryOpcode op_code, const expr_t rhs);
   //! Ramsey policy statement
   void ramsey_policy();
   //! Discretionary policy statement
@@ -618,9 +610,9 @@ public:
   //! Adds a write_latex_steady_state_model statement
   void write_latex_steady_state_model();
   //! BVAR marginal density
-  void bvar_density(string *maxnlags);
+  void bvar_density(const string &maxnlags);
   //! BVAR forecast
-  void bvar_forecast(string *nlags);
+  void bvar_forecast(const string &nlags);
   //! SBVAR statement
   void sbvar();
   //! Markov Switching Statement: Estimation
@@ -654,7 +646,7 @@ public:
   //! Conditional forecast paths block
   void conditional_forecast_paths();
   //! Plot conditional forecast statement
-  void plot_conditional_forecast(string *periods = nullptr);
+  void plot_conditional_forecast(const string &periods = "");
   //! Smoother on calibrated models
   void calib_smoother();
   //! Extended path
@@ -688,20 +680,20 @@ public:
   //! Writes token "arg1^arg2" to model tree
   expr_t add_power(expr_t arg1,  expr_t arg2);
   //! Writes token "E(arg1)(arg2)" to model tree
-  expr_t add_expectation(string *arg1,  expr_t arg2);
+  expr_t add_expectation(const string &arg1,  expr_t arg2);
   //! Writes token "VAR_EXPECTATION(arg1, arg2, arg3)" to model tree
-  expr_t add_var_expectation(string *arg1,  string *arg2, string *arg3);
+  expr_t add_var_expectation(const string &arg1, const string &arg2, const string &arg3);
   //! Writes token "PAC_EXPECTATION(model_name, discount, growth)" to model tree
-  expr_t add_pac_expectation(string *var_model_name);
+  expr_t add_pac_expectation(const string &var_model_name);
   //! Creates pac_model statement
   void pac_model();
   //! Add undiff option for pac_model statement
-  void pac_model_undiff(string *eqtag, string *order);
+  void pac_model_undiff(string eqtag, const string &order);
   //! Writes token "diff(arg1)" to model tree
   expr_t add_diff(expr_t arg1);
   //! Writes token "adl(arg1, lag)" to model tree
-  expr_t add_adl(expr_t arg1, string *name, string *lag);
-  expr_t add_adl(expr_t arg1, string *name, vector<int> *lags);
+  expr_t add_adl(expr_t arg1, const string &name, const string &lag);
+  expr_t add_adl(expr_t arg1, const string &name, const vector<int> &lags);
   //! Writes token "exp(arg1)" to model tree
   expr_t add_exp(expr_t arg1);
   //! Writes token "log(arg1)" to model tree
@@ -761,31 +753,31 @@ public:
   //! Test to see if model/external function has exactly one integer argument
   pair<bool, double> is_there_one_integer_argument() const;
   //! Adds an external function call node
-  expr_t add_model_var_or_external_function(string *function_name, bool in_model_block);
+  expr_t add_model_var_or_external_function(const string &function_name, bool in_model_block);
   //! Adds a native statement
   void add_native(const string &s);
   //! Adds a native statement, first removing the set of characters passed in token (and everything after)
-  void add_native_remove_charset(const char *s, const string &token);
+  void add_native_remove_charset(string str, const string &token);
   //! Adds a verbatim statement
   void add_verbatim(const string &s);
   //! Adds a verbatim statement, first removing the set of characters passed in token (and everything after)
-  void add_verbatim_remove_charset(const char *s, const string &token);
+  void add_verbatim_remove_charset(string str, const string &token);
   //! Resets data_tree and model_tree pointers to default (i.e. mod_file->expressions_tree)
   void reset_data_tree();
   //! Begin a steady_state_model block
   void begin_steady_state_model();
   //! Add an assignment equation in steady_state_model block
-  void add_steady_state_model_equal(string *varname, expr_t expr);
+  void add_steady_state_model_equal(const string &varname, expr_t expr);
   //! Add a multiple assignment equation in steady_state_model block
   void add_steady_state_model_equal_multiple(expr_t expr);
   //! Switches datatree
   void begin_trend();
   //! Declares a trend variable with its growth factor
-  void declare_trend_var(bool log_trend, string *name, string *tex_name = nullptr);
+  void declare_trend_var(bool log_trend, const string &name, const string &tex_name = "");
   //! Ends declaration of trend variable
   void end_trend_var(expr_t growth_factor);
   //! Declares a nonstationary variable with its deflator
-  void declare_nonstationary_var(string *name, string *tex_name = nullptr, vector<pair<string *, string *> *> *partition_value = nullptr);
+  void declare_nonstationary_var(const string &name, const string &tex_name = "", const vector<pair<string, string>> &partition_value = {});
   //! Ends declaration of nonstationary variable
   void end_nonstationary_var(bool log_deflator, expr_t deflator);
   //! Add a graph format to the list of formats requested
@@ -797,40 +789,40 @@ public:
   //! Model diagnostics
   void model_diagnostics();
   //! Processing the parallel_local_files option
-  void add_parallel_local_file(string *filename);
+  void add_parallel_local_file(string filename);
   //! Add an item of a moment_calibration statement
-  void add_moment_calibration_item(string *endo1, string *endo2, string *lags, vector<string *> *range);
+  void add_moment_calibration_item(const string &endo1, const string &endo2, string lags, const pair<string, string> &range);
   //! End a moment_calibration statement
   void end_moment_calibration();
   //! Add an item of an irf_calibration statement
-  void add_irf_calibration_item(string *endo, string *periods, string *exo, vector<string *> *range);
+  void add_irf_calibration_item(const string &endo, string periods, const string &exo, const pair<string, string> &range);
   //! End a moment_calibration statement
   void end_irf_calibration();
   //! Add a shock to a group
-  void add_shock_group_element(string *name);
+  void add_shock_group_element(string name);
   //! Add a set of shock groups
-  void add_shock_group(string *name);
+  void add_shock_group(string name);
   //! End shock groups declaration
-  void end_shock_groups(const string *name);
+  void end_shock_groups(const string &name);
   //! Add an element to the ramsey policy list
-  void add_to_ramsey_policy_list(string *name);
+  void add_to_ramsey_policy_list(string name);
   void smoother2histval();
-  void histval_file(string *filename);
+  void histval_file(const string &filename);
   void perfect_foresight_setup();
   void perfect_foresight_solver();
   void prior_posterior_function(bool prior_func);
   //! VAR Restrictions
   void begin_VAR_restrictions();
-  void end_VAR_restrictions(string *var_model_name);
-  void add_VAR_exclusion_restriction(string *lagstr);
-  void add_VAR_restriction_exclusion_equation(string *name);
-  void add_VAR_restriction_coeff(string *name1, string *name2, string *lagstr);
+  void end_VAR_restrictions(const string &var_model_name);
+  void add_VAR_exclusion_restriction(const string &lagstr);
+  void add_VAR_restriction_exclusion_equation(const string &name);
+  void add_VAR_restriction_coeff(const string &name1, const string &name2, const string &lagstr);
   void add_VAR_restriction_eq_or_crosseq(expr_t expr);
-  void add_VAR_restriction_equation_or_crossequation(string *numberstr);
+  void add_VAR_restriction_equation_or_crossequation(const string &numberstr);
   void multiply_arg2_by_neg_one();
-  void add_VAR_restriction_equation_or_crossequation_final(string *name);
-  void add_VAR_covariance_number_restriction(string *name1, string *name2, string *valuestr);
-  void add_VAR_covariance_pair_restriction(string *name11, string *name12, string *name21, string *name22);
+  void add_VAR_restriction_equation_or_crossequation_final(const string &name);
+  void add_VAR_covariance_number_restriction(const string &name1, const string &name2, const string &valuestr);
+  void add_VAR_covariance_pair_restriction(const string &name11, const string &name12, const string &name21, const string &name22);
   //! Runs VAR estimation process
   void run_var_estimation();
   //! GMM Estimation statement
diff --git a/src/SymbolTable.cc b/src/SymbolTable.cc
index 4a80927d3a9ee8864dc6259a4056407d90cb1418..e5b3ed765b7f7dbba8aa19d527c19e743cd53b0b 100644
--- a/src/SymbolTable.cc
+++ b/src/SymbolTable.cc
@@ -42,7 +42,7 @@ SymbolTable::SymbolTable()
 = default;
 
 int
-SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string *, string *> *> *partition_value) noexcept(false)
+SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string, string>> &partition_value) noexcept(false)
 {
   if (frozen)
     throw FrozenException();
@@ -69,12 +69,11 @@ SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_na
 
   string final_long_name = name;
   bool non_long_name_partition_exists = false;
-  if (partition_value)
-    for (auto it : *partition_value)
-      if (*(it->first) == "long_name")
-        final_long_name = *(it->second);
-      else
-        non_long_name_partition_exists = true;
+  for (auto it : partition_value)
+    if (it.first == "long_name")
+      final_long_name = it.second;
+    else
+      non_long_name_partition_exists = true;
 
   int id = symbol_table.size();
 
@@ -86,8 +85,8 @@ SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_na
   if (non_long_name_partition_exists)
     {
       map<string, string> pmv;
-      for (auto it : *partition_value)
-        pmv[*(it->first)] = *(it->second);
+      for (auto it : partition_value)
+        pmv[it.first] = it.second;
       partition_value_map[id] = pmv;
     }
   return id;
@@ -96,7 +95,7 @@ SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_na
 int
 SymbolTable::addSymbol(const string &name, SymbolType type) noexcept(false)
 {
-  return addSymbol(name, type, "", nullptr);
+  return addSymbol(name, type, "", {});
 }
 
 void
diff --git a/src/SymbolTable.hh b/src/SymbolTable.hh
index 622522cded68d76611bbc95bd553b7d447a772e5..c2b47d2199574a4b218f077ef9e03c173bf9e1d4 100644
--- a/src/SymbolTable.hh
+++ b/src/SymbolTable.hh
@@ -237,7 +237,7 @@ private:
 public:
   //! Add a symbol
   /*! Returns the symbol ID */
-  int addSymbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string *, string *> *> *partition_value) noexcept(false);
+  int addSymbol(const string &name, SymbolType type, const string &tex_name, const vector<pair<string, string>> &partition_value) noexcept(false);
   //! Add a symbol without its TeX name (will be equal to its name)
   /*! Returns the symbol ID */
   int addSymbol(const string &name, SymbolType type) noexcept(false);