diff --git a/mex/sources/bytecode/ErrorHandling.hh b/mex/sources/bytecode/ErrorHandling.hh
index 82d4b2c8c9a45680ae87aa488a6543c935520476..e94b84dc9a273f43411b070258f2bda12c4f2fad 100644
--- a/mex/sources/bytecode/ErrorHandling.hh
+++ b/mex/sources/bytecode/ErrorHandling.hh
@@ -419,14 +419,14 @@ public:
         for (unsigned int i = 0; i < endo_name_length; i++)
           if (P_endo_names[CHAR_LENGTH*(variable_num+i*nb_endo)] != ' ')
             res << P_endo_names[CHAR_LENGTH*(variable_num+i*nb_endo)];
-        Variable_list.push_back(make_pair(res.str(), make_pair(eEndogenous, variable_num)));
+        Variable_list.push_back(make_pair(res.str(), make_pair(SymbolType::endogenous, variable_num)));
       }
     for (unsigned int variable_num = 0; variable_num < (unsigned int) nb_exo; variable_num++)
       {
         for (unsigned int i = 0; i < exo_name_length; i++)
           if (P_exo_names[CHAR_LENGTH*(variable_num+i*nb_exo)] != ' ')
             res << P_exo_names[CHAR_LENGTH*(variable_num+i*nb_exo)];
-        Variable_list.push_back(make_pair(res.str(), make_pair(eExogenous, variable_num)));
+        Variable_list.push_back(make_pair(res.str(), make_pair(SymbolType::exogenous, variable_num)));
       }
   }
 
@@ -460,7 +460,7 @@ public:
     ostringstream res;
     switch (variable_type)
       {
-      case eEndogenous:
+      case SymbolType::endogenous:
         if (variable_num <= nb_endo)
           {
             for (unsigned int i = 0; i < endo_name_length; i++)
@@ -470,8 +470,8 @@ public:
         else
           mexPrintf("=> Unknown endogenous variable # %d", variable_num);
         break;
-      case eExogenous:
-      case eExogenousDet:
+      case SymbolType::exogenous:
+      case SymbolType::exogenousDet:
         if (variable_num <= nb_exo)
           {
             for (unsigned int i = 0; i < exo_name_length; i++)
@@ -481,7 +481,7 @@ public:
         else
           mexPrintf("=> Unknown exogenous variable # %d", variable_num);
         break;
-      case eParameter:
+      case SymbolType::parameter:
         if (variable_num <= nb_param)
           {
             for (unsigned int i = 0; i < param_name_length; i++)
@@ -518,33 +518,33 @@ public:
           break;
         case FirstEndoDerivative:
           if (EQN_block_number > 1)
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to endogenous variable " << get_variable(eEndogenous, EQN_dvar1) << " at time " << it_;
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to endogenous variable " << get_variable(SymbolType::endogenous, EQN_dvar1) << " at time " << it_;
           else
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to endogenous variable " << get_variable(eEndogenous, EQN_dvar1) << " at time " << it_;
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to endogenous variable " << get_variable(SymbolType::endogenous, EQN_dvar1) << " at time " << it_;
           break;
         case FirstOtherEndoDerivative:
           if (EQN_block_number > 1)
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to other endogenous variable "  << get_variable(eEndogenous, EQN_dvar1) << " at time " << it_;
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to other endogenous variable "  << get_variable(SymbolType::endogenous, EQN_dvar1) << " at time " << it_;
           else
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to other endogenous variable " << get_variable(eEndogenous, EQN_dvar1) << " at time " << it_;
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to other endogenous variable " << get_variable(SymbolType::endogenous, EQN_dvar1) << " at time " << it_;
           break;
         case FirstExoDerivative:
           if (EQN_block_number > 1)
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to exogenous variable "  << get_variable(eEndogenous, EQN_dvar1) << " at time " << it_;
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to exogenous variable "  << get_variable(SymbolType::endogenous, EQN_dvar1) << " at time " << it_;
           else
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to exogenous variable " << get_variable(eEndogenous, EQN_dvar1) << " at time " << it_;
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to exogenous variable " << get_variable(SymbolType::endogenous, EQN_dvar1) << " at time " << it_;
           break;
         case FirstExodetDerivative:
           if (EQN_block_number > 1)
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to deterministic exogenous variable "  << get_variable(eEndogenous, EQN_dvar1) << " at time " << it_;
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to deterministic exogenous variable "  << get_variable(SymbolType::endogenous, EQN_dvar1) << " at time " << it_;
           else
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to deterministic exogenous variable " << get_variable(eEndogenous, EQN_dvar1) << " at time " << it_;
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to deterministic exogenous variable " << get_variable(SymbolType::endogenous, EQN_dvar1) << " at time " << it_;
           break;
         case FirstParamDerivative:
           if (EQN_block_number > 1)
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to parameter "  << get_variable(eEndogenous, EQN_dvar1) << " at time " << it_;
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to parameter "  << get_variable(SymbolType::endogenous, EQN_dvar1) << " at time " << it_;
           else
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to parameter " << get_variable(eEndogenous, EQN_dvar1) << " at time " << it_;
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to parameter " << get_variable(SymbolType::endogenous, EQN_dvar1) << " at time " << it_;
           break;
         default:
           return ("???");
@@ -566,33 +566,33 @@ public:
           break;
         case FirstEndoDerivative:
           if (EQN_block_number > 1)
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to endogenous variable "  << get_variable(eEndogenous, EQN_dvar1);
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to endogenous variable "  << get_variable(SymbolType::endogenous, EQN_dvar1);
           else
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to endogenous variable " << get_variable(eEndogenous, EQN_dvar1);
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to endogenous variable " << get_variable(SymbolType::endogenous, EQN_dvar1);
           break;
         case FirstOtherEndoDerivative:
           if (EQN_block_number > 1)
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to other endogenous variable "  << get_variable(eEndogenous, EQN_dvar1);
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to other endogenous variable "  << get_variable(SymbolType::endogenous, EQN_dvar1);
           else
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to other endogenous variable " << get_variable(eEndogenous, EQN_dvar1);
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to other endogenous variable " << get_variable(SymbolType::endogenous, EQN_dvar1);
           break;
         case FirstExoDerivative:
           if (EQN_block_number > 1)
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to exogenous variable "  << get_variable(eEndogenous, EQN_dvar1);
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to exogenous variable "  << get_variable(SymbolType::endogenous, EQN_dvar1);
           else
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to exogenous variable " << get_variable(eEndogenous, EQN_dvar1);
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to exogenous variable " << get_variable(SymbolType::endogenous, EQN_dvar1);
           break;
         case FirstExodetDerivative:
           if (EQN_block_number > 1)
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to deterministic exogenous variable "  << get_variable(eEndogenous, EQN_dvar1);
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to deterministic exogenous variable "  << get_variable(SymbolType::endogenous, EQN_dvar1);
           else
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to deterministic exogenous variable " << get_variable(eEndogenous, EQN_dvar1);
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to deterministic exogenous variable " << get_variable(SymbolType::endogenous, EQN_dvar1);
           break;
         case FirstParamDerivative:
           if (EQN_block_number > 1)
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to parameter "  << get_variable(eEndogenous, EQN_dvar1);
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " in block " << EQN_block+1 << " with respect to parameter "  << get_variable(SymbolType::endogenous, EQN_dvar1);
           else
-            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to parameter " << get_variable(eEndogenous, EQN_dvar1);
+            Error_loc << "first order derivative of equation " << EQN_equation+1 << " with respect to parameter " << get_variable(SymbolType::endogenous, EQN_dvar1);
           break;
         default:
           return ("???");
@@ -616,7 +616,7 @@ public:
     ExpressionType equation_type = TemporaryTerm;
     size_t found;
     double *jacob = NULL, *jacob_other_endo = NULL, *jacob_exo = NULL, *jacob_exo_det = NULL;
-    external_function_type function_type = ExternalFunctionWithoutDerivative;
+    ExternalFunctionType function_type = ExternalFunctionType::withoutDerivative;
 
     if (evaluate)
       {
@@ -693,35 +693,35 @@ public:
             break;
           case FLDV:
             //load a variable in the processor
-            switch (((FLDV_ *) it_code->second)->get_type())
+            switch (static_cast<SymbolType>(((FLDV_ *) it_code->second)->get_type()))
               {
-              case eParameter:
+              case SymbolType::parameter:
                 var = ((FLDV_ *) it_code->second)->get_pos();
 #ifdef DEBUG
                 mexPrintf("FLDV_ Param var=%d\n", var);
-                mexPrintf("get_variable(eParameter, var)=%s\n", get_variable(eParameter, var).c_str());
+                mexPrintf("get_variable(SymbolType::parameter, var)=%s\n", get_variable(SymbolType::parameter, var).c_str());
                 mexEvalString("drawnow;");
 #endif
-                Stack.push(get_variable(eParameter, var));
+                Stack.push(get_variable(SymbolType::parameter, var));
                 if (compute)
                   Stackf.push(params[var]);
                 break;
-              case eEndogenous:
+              case SymbolType::endogenous:
                 var = ((FLDV_ *) it_code->second)->get_pos();
                 lag = ((FLDV_ *) it_code->second)->get_lead_lag();
 #ifdef DEBUG
                 mexPrintf("FLDV_ endo var=%d, lag=%d\n", var, lag);
-                mexPrintf("get_variable(eEndogenous, var)=%s, compute=%d\n", get_variable(eEndogenous, var).c_str(), compute);
+                mexPrintf("get_variable(SymbolType::endogenous, var)=%s, compute=%d\n", get_variable(SymbolType::endogenous, var).c_str(), compute);
                 mexPrintf("it_=%d, lag=%d, y_size=%d, var=%d, y=%x\n", it_, lag, y_size, var, y);
                 mexEvalString("drawnow;");
 #endif
                 tmp_out.str("");
                 if (lag > 0)
-                  tmp_out << get_variable(eEndogenous, var) << "(+" << lag << ")";
+                  tmp_out << get_variable(SymbolType::endogenous, var) << "(+" << lag << ")";
                 else if (lag < 0)
-                  tmp_out << get_variable(eEndogenous, var) << "(" << lag << ")";
+                  tmp_out << get_variable(SymbolType::endogenous, var) << "(" << lag << ")";
                 else
-                  tmp_out << get_variable(eEndogenous, var);
+                  tmp_out << get_variable(SymbolType::endogenous, var);
                 Stack.push(tmp_out.str());
                 if (compute)
                   {
@@ -731,7 +731,7 @@ public:
                       Stackf.push(y[(it_+lag)*y_size+var]);
                   }
                 break;
-              case eExogenous:
+              case SymbolType::exogenous:
                 var = ((FLDV_ *) it_code->second)->get_pos();
                 lag = ((FLDV_ *) it_code->second)->get_lead_lag();
 #ifdef DEBUG
@@ -739,14 +739,14 @@ public:
 #endif
                 tmp_out.str("");
                 if (lag != 0)
-                  tmp_out << get_variable(eExogenous, var) << "(" << lag << ")";
+                  tmp_out << get_variable(SymbolType::exogenous, var) << "(" << lag << ")";
                 else
-                  tmp_out << get_variable(eExogenous, var);
+                  tmp_out << get_variable(SymbolType::exogenous, var);
                 Stack.push(tmp_out.str());
                 if (compute)
                   Stackf.push(x[it_+lag+var*nb_row_x]);
                 break;
-              case eExogenousDet:
+              case SymbolType::exogenousDet:
                 var = ((FLDV_ *) it_code->second)->get_pos();
                 lag = ((FLDV_ *) it_code->second)->get_lead_lag();
 #ifdef DEBUG
@@ -754,14 +754,14 @@ public:
 #endif
                 tmp_out.str("");
                 if (lag != 0)
-                  tmp_out << get_variable(eExogenousDet, var) << "(" << lag << ")";
+                  tmp_out << get_variable(SymbolType::exogenousDet, var) << "(" << lag << ")";
                 else
-                  tmp_out << get_variable(eExogenousDet, var);
+                  tmp_out << get_variable(SymbolType::exogenousDet, var);
                 Stack.push(tmp_out.str());
                 if (compute)
                   Stackf.push(x[it_+lag+var*nb_row_xd]);
                 break;
-              case eModelLocalVariable:
+              case SymbolType::modelLocalVariable:
                 break;
               default:
                 mexPrintf("FLDV: Unknown variable type\n");
@@ -770,23 +770,23 @@ public:
           case FLDSV:
           case FLDVS:
             //load a variable in the processor
-            switch (((FLDSV_ *) it_code->second)->get_type())
+            switch (static_cast<SymbolType>(((FLDSV_ *) it_code->second)->get_type()))
               {
-              case eParameter:
+              case SymbolType::parameter:
                 var = ((FLDSV_ *) it_code->second)->get_pos();
 #ifdef DEBUG
                 mexPrintf("FLDSV_ param var=%d", var);
 #endif
-                Stack.push(get_variable(eParameter, var));
+                Stack.push(get_variable(SymbolType::parameter, var));
                 if (compute)
                   Stackf.push(params[var]);
                 break;
-              case eEndogenous:
+              case SymbolType::endogenous:
                 var = ((FLDSV_ *) it_code->second)->get_pos();
 #ifdef DEBUG
                 mexPrintf("FLDSV_ endo var=%d", var);
 #endif
-                Stack.push(get_variable(eEndogenous, var));
+                Stack.push(get_variable(SymbolType::endogenous, var));
                 if (compute)
                   {
                     if (it_code->first == FLDSV)
@@ -800,28 +800,28 @@ public:
                       Stackf.push(steady_y[var]);
                   }
                 break;
-              case eExogenous:
+              case SymbolType::exogenous:
                 var = ((FLDSV_ *) it_code->second)->get_pos();
 #ifdef DEBUG
                 mexPrintf("FLDSV_ exo var=%d", var);
 #endif
-                Stack.push(get_variable(eExogenous, var));
+                Stack.push(get_variable(SymbolType::exogenous, var));
 #ifdef DEBUG
                 mexPrintf("oka var=%d, Stack.size()=%d x=%x\n", var, Stack.size(), x);
 #endif
                 if (compute)
                   Stackf.push(x[var]);
                 break;
-              case eExogenousDet:
+              case SymbolType::exogenousDet:
                 var = ((FLDSV_ *) it_code->second)->get_pos();
 #ifdef DEBUG
                 mexPrintf("FLDSV_ exo_det var=%d", var);
 #endif
-                Stack.push(get_variable(eExogenousDet, var));
+                Stack.push(get_variable(SymbolType::exogenousDet, var));
                 if (compute)
                   Stackf.push(x[var]);
                 break;
-              case eModelLocalVariable:
+              case SymbolType::modelLocalVariable:
                 break;
               default:
                 mexPrintf("FLDSV: Unknown variable type\n");
@@ -913,9 +913,9 @@ public:
           case FSTPV:
             //load a variable in the processor
             go_on = false;
-            switch (((FSTPV_ *) it_code->second)->get_type())
+            switch (static_cast<SymbolType>(((FSTPV_ *) it_code->second)->get_type()))
               {
-              case eParameter:
+              case SymbolType::parameter:
                 var = ((FSTPV_ *) it_code->second)->get_pos();
 #ifdef DEBUG
                 mexPrintf("FSTPV_ param var=%d", var);
@@ -923,7 +923,7 @@ public:
                 tmp_out2.str("");
                 tmp_out2 << Stack.top();
                 tmp_out.str("");
-                tmp_out << get_variable(eParameter, var) << " = " << tmp_out2.str();
+                tmp_out << get_variable(SymbolType::parameter, var) << " = " << tmp_out2.str();
                 Stack.pop();
                 if (compute)
                   {
@@ -931,7 +931,7 @@ public:
                     Stackf.pop();
                   }
                 break;
-              case eEndogenous:
+              case SymbolType::endogenous:
                 var = ((FSTPV_ *) it_code->second)->get_pos();
                 lag = ((FSTPV_ *) it_code->second)->get_lead_lag();
 #ifdef DEBUG
@@ -940,7 +940,7 @@ public:
                 tmp_out2.str("");
                 tmp_out2 << Stack.top();
                 tmp_out.str("");
-                tmp_out << get_variable(eEndogenous, var);
+                tmp_out << get_variable(SymbolType::endogenous, var);
                 if (lag > 0)
                   tmp_out << "(+" << lag << ")";
                 else if (lag < 0)
@@ -953,7 +953,7 @@ public:
                     Stackf.pop();
                   }
                 break;
-              case eExogenous:
+              case SymbolType::exogenous:
                 var = ((FSTPV_ *) it_code->second)->get_pos();
                 lag = ((FSTPV_ *) it_code->second)->get_lead_lag();
 #ifdef DEBUG
@@ -962,7 +962,7 @@ public:
                 tmp_out2.str("");
                 tmp_out2 << Stack.top();
                 tmp_out.str("");
-                tmp_out << get_variable(eExogenous, var);
+                tmp_out << get_variable(SymbolType::exogenous, var);
                 if (lag != 0)
                   tmp_out << "(" << lag << ")";
                 tmp_out << " = " << tmp_out2.str();
@@ -973,7 +973,7 @@ public:
                     Stackf.pop();
                   }
                 break;
-              case eExogenousDet:
+              case SymbolType::exogenousDet:
                 var = ((FSTPV_ *) it_code->second)->get_pos();
                 lag = ((FSTPV_ *) it_code->second)->get_lead_lag();
 #ifdef DEBUG
@@ -982,7 +982,7 @@ public:
                 tmp_out2.str("");
                 tmp_out2 << Stack.top();
                 tmp_out.str("");
-                tmp_out << get_variable(eExogenousDet, var);
+                tmp_out << get_variable(SymbolType::exogenousDet, var);
                 if (lag != 0)
                   tmp_out << "(" << lag << ")";
                 tmp_out << " = " << tmp_out2.str();
@@ -1000,9 +1000,9 @@ public:
           case FSTPSV:
             go_on = false;
             //load a variable in the processor
-            switch (((FSTPSV_ *) it_code->second)->get_type())
+            switch (static_cast<SymbolType>(((FSTPSV_ *) it_code->second)->get_type()))
               {
-              case eParameter:
+              case SymbolType::parameter:
                 var = ((FSTPSV_ *) it_code->second)->get_pos();
 #ifdef DEBUG
                 mexPrintf("FSTPSV_ param var=%d", var);
@@ -1010,7 +1010,7 @@ public:
                 tmp_out2.str("");
                 tmp_out2 << Stack.top();
                 tmp_out.str("");
-                tmp_out << get_variable(eParameter, var);
+                tmp_out << get_variable(SymbolType::parameter, var);
                 tmp_out << " = " << tmp_out2.str();
                 Stack.pop();
                 if (compute)
@@ -1019,7 +1019,7 @@ public:
                     Stackf.pop();
                   }
                 break;
-              case eEndogenous:
+              case SymbolType::endogenous:
                 var = ((FSTPSV_ *) it_code->second)->get_pos();
 #ifdef DEBUG
                 mexPrintf("FSTPSV_ endo var=%d", var);
@@ -1027,7 +1027,7 @@ public:
                 tmp_out2.str("");
                 tmp_out2 << Stack.top();
                 tmp_out.str("");
-                tmp_out << get_variable(eEndogenous, var);
+                tmp_out << get_variable(SymbolType::endogenous, var);
                 tmp_out << " = " << tmp_out2.str();
                 Stack.pop();
                 if (compute)
@@ -1036,8 +1036,8 @@ public:
                     Stackf.pop();
                   }
                 break;
-              case eExogenous:
-              case eExogenousDet:
+              case SymbolType::exogenous:
+              case SymbolType::exogenousDet:
                 var = ((FSTPSV_ *) it_code->second)->get_pos();
 #ifdef DEBUG
                 mexPrintf("FSTPSV_ exo var=%d", var);
@@ -1045,7 +1045,7 @@ public:
                 tmp_out2.str("");
                 tmp_out2 << Stack.top();
                 tmp_out.str("");
-                tmp_out << get_variable(eExogenous, var);
+                tmp_out << get_variable(SymbolType::exogenous, var);
                 tmp_out << " = " << tmp_out2.str();
                 Stack.pop();
                 if (compute)
@@ -1251,9 +1251,9 @@ public:
                 v1f = Stackf.top();
                 Stackf.pop();
               }
-            switch (op)
+            switch (static_cast<BinaryOpcode>(op))
               {
-              case oPlus:
+              case BinaryOpcode::plus:
 #ifdef DEBUG
                 mexPrintf("+");
 #endif
@@ -1263,7 +1263,7 @@ public:
                 tmp_out << v1 << " + " << v2;
                 Stack.push(tmp_out.str());
                 break;
-              case oMinus:
+              case BinaryOpcode::minus:
 #ifdef DEBUG
                 mexPrintf("-");
 #endif
@@ -1285,7 +1285,7 @@ public:
                   tmp_out << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oTimes:
+              case BinaryOpcode::times:
 #ifdef DEBUG
                 mexPrintf("*");
 #endif
@@ -1307,7 +1307,7 @@ public:
                   tmp_out << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oDivide:
+              case BinaryOpcode::divide:
 #ifdef DEBUG
                 mexPrintf("/");
 #endif
@@ -1341,7 +1341,7 @@ public:
                   tmp_out << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oLess:
+              case BinaryOpcode::less:
 #ifdef DEBUG
                 mexPrintf("<");
 #endif
@@ -1363,7 +1363,7 @@ public:
                   tmp_out << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oGreater:
+              case BinaryOpcode::greater:
 #ifdef DEBUG
                 mexPrintf(">");
 #endif
@@ -1385,7 +1385,7 @@ public:
                   tmp_out << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oLessEqual:
+              case BinaryOpcode::lessEqual:
 #ifdef DEBUG
                 mexPrintf("<=");
 #endif
@@ -1407,7 +1407,7 @@ public:
                   tmp_out << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oGreaterEqual:
+              case BinaryOpcode::greaterEqual:
 #ifdef DEBUG
                 mexPrintf(">=");
 #endif
@@ -1429,7 +1429,7 @@ public:
                   tmp_out << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oEqualEqual:
+              case BinaryOpcode::equalEqual:
 #ifdef DEBUG
                 mexPrintf("==");
 #endif
@@ -1451,7 +1451,7 @@ public:
                   tmp_out << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oDifferent:
+              case BinaryOpcode::different:
 #ifdef DEBUG
                 mexPrintf("!=");
 #endif
@@ -1473,7 +1473,7 @@ public:
                   tmp_out << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oPower:
+              case BinaryOpcode::power:
 #ifdef DEBUG
                 mexPrintf("^");
 #endif
@@ -1506,7 +1506,7 @@ public:
                   tmp_out << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oPowerDeriv:
+              case BinaryOpcode::powerDeriv:
                 {
                   v3 = Stack.top();
                   Stack.pop();
@@ -1514,9 +1514,9 @@ public:
                     {
                       int derivOrder = int (nearbyint(Stackf.top()));
                       Stackf.pop();
-                      if (fabs(v1f) < NEAR_ZERO && v2f > 0
+                      if (fabs(v1f) < near_zero && v2f > 0
                           && derivOrder > v2f
-                          && fabs(v2f-nearbyint(v2f)) < NEAR_ZERO)
+                          && fabs(v2f-nearbyint(v2f)) < near_zero)
                         {
                           r = 0.0;
                           Stackf.push(r);
@@ -1547,7 +1547,7 @@ public:
                 tmp_out << " |PowerDeriv(" << v1 << ", " << v2 << v3 << ")|";
 #endif
                 break;
-              case oMax:
+              case BinaryOpcode::max:
 #ifdef DEBUG
                 mexPrintf("max");
 #endif
@@ -1557,7 +1557,7 @@ public:
                 tmp_out << "max(" << v1 << ", " << v2 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oMin:
+              case BinaryOpcode::min:
 #ifdef DEBUG
                 mexPrintf("min");
 #endif
@@ -1567,7 +1567,7 @@ public:
                 tmp_out << "min(" << v1 << ", " << v2 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oEqual:
+              case BinaryOpcode::equal:
               default:
                 mexPrintf("Error unknown Unary operator=%d\n", op); mexEvalString("drawnow;");
                 ;
@@ -1582,23 +1582,23 @@ public:
                 v1f = Stackf.top();
                 Stackf.pop();
               }
-            switch (op)
+            switch (static_cast<UnaryOpcode>(op))
               {
-              case oUminus:
+              case UnaryOpcode::uminus:
                 if (compute)
                   Stackf.push(-v1f);
                 tmp_out.str("");
                 tmp_out << " -" << v1;
                 Stack.push(tmp_out.str());
                 break;
-              case oExp:
+              case UnaryOpcode::exp:
                 if (compute)
                   Stackf.push(exp(v1f));
                 tmp_out.str("");
                 tmp_out << "exp(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oLog:
+              case UnaryOpcode::log:
                 if (compute)
                   {
                     r = log(v1f);
@@ -1616,7 +1616,7 @@ public:
                   tmp_out << "log(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oLog10:
+              case UnaryOpcode::log10:
                 if (compute)
                   {
                     r = log10(v1f);
@@ -1634,98 +1634,98 @@ public:
                   tmp_out << "log10(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oCos:
+              case UnaryOpcode::cos:
                 if (compute)
                   Stackf.push(cos(v1f));
                 tmp_out.str("");
                 tmp_out << "cos(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oSin:
+              case UnaryOpcode::sin:
                 if (compute)
                   Stackf.push(sin(v1f));
                 tmp_out.str("");
                 tmp_out << "sin(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oTan:
+              case UnaryOpcode::tan:
                 if (compute)
                   Stackf.push(tan(v1f));
                 tmp_out.str("");
                 tmp_out << "tan(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oAcos:
+              case UnaryOpcode::acos:
                 if (compute)
                   Stackf.push(acos(v1f));
                 tmp_out.str("");
                 tmp_out << "acos(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oAsin:
+              case UnaryOpcode::asin:
                 if (compute)
                   Stackf.push(asin(v1f));
                 tmp_out.str("");
                 tmp_out << "asin(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oAtan:
+              case UnaryOpcode::atan:
                 if (compute)
                   Stackf.push(atan(v1f));
                 tmp_out.str("");
                 tmp_out << "atan(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oCosh:
+              case UnaryOpcode::cosh:
                 if (compute)
                   Stackf.push(cosh(v1f));
                 tmp_out.str("");
                 tmp_out << "cosh(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oSinh:
+              case UnaryOpcode::sinh:
                 if (compute)
                   Stackf.push(sinh(v1f));
                 tmp_out.str("");
                 tmp_out << "sinh(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oTanh:
+              case UnaryOpcode::tanh:
                 if (compute)
                   Stackf.push(tanh(v1f));
                 tmp_out.str("");
                 tmp_out << "tanh(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oAcosh:
+              case UnaryOpcode::acosh:
                 if (compute)
                   Stackf.push(acosh(v1f));
                 tmp_out.str("");
                 tmp_out << "acosh(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oAsinh:
+              case UnaryOpcode::asinh:
                 if (compute)
                   Stackf.push(asinh(v1f));
                 tmp_out.str("");
                 tmp_out << "asinh(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oAtanh:
+              case UnaryOpcode::atanh:
                 if (compute)
                   Stackf.push(atanh(v1f));
                 tmp_out.str("");
                 tmp_out << "atanh(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oSqrt:
+              case UnaryOpcode::sqrt:
                 if (compute)
                   Stackf.push(sqrt(v1f));
                 tmp_out.str("");
                 tmp_out << "sqrt(" << v1 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oErf:
+              case UnaryOpcode::erf:
                 if (compute)
                   Stackf.push(erf(v1f));
                 tmp_out.str("");
@@ -1754,16 +1754,16 @@ public:
                 v1f = Stackf.top();
                 Stackf.pop();
               }
-            switch (op)
+            switch (static_cast<TrinaryOpcode>(op))
               {
-              case oNormcdf:
+              case TrinaryOpcode::normcdf:
                 if (compute)
                   Stackf.push(0.5*(1+erf((v1f-v2f)/v3f/M_SQRT2)));
                 tmp_out.str("");
                 tmp_out << "normcdf(" << v1 << ", " << v2 << ", " << v3 << ")";
                 Stack.push(tmp_out.str());
                 break;
-              case oNormpdf:
+              case TrinaryOpcode::normpdf:
                 if (compute)
                   Stackf.push(1/(v3f*sqrt(2*M_PI)*exp(pow((v1f-v2f)/v3f, 2)/2)));
                 tmp_out.str("");
@@ -1809,9 +1809,9 @@ public:
               mxArray **input_arguments;
               switch (function_type)
                 {
-                case ExternalFunctionWithoutDerivative:
-                case ExternalFunctionWithFirstDerivative:
-                case ExternalFunctionWithFirstandSecondDerivative:
+                case ExternalFunctionType::withoutDerivative:
+                case ExternalFunctionType::withFirstDerivative:
+                case ExternalFunctionType::withFirstAndSecondDerivative:
                   {
                     if (compute)
                       {
@@ -1848,7 +1848,7 @@ public:
                     Stack.push(tmp_out.str());
                   }
                   break;
-                case ExternalFunctionNumericalFirstDerivative:
+                case ExternalFunctionType::numericalFirstDerivative:
                   {
                     if (compute)
                       {
@@ -1902,7 +1902,7 @@ public:
                     Stack.push(tmp_out.str());
                   }
                   break;
-                case ExternalFunctionFirstDerivative:
+                case ExternalFunctionType::firstDerivative:
                   {
                     if (compute)
                       {
@@ -1933,7 +1933,7 @@ public:
                     Stack.push(tmp_out.str());
                   }
                   break;
-                case ExternalFunctionNumericalSecondDerivative:
+                case ExternalFunctionType::numericalSecondDerivative:
                   {
                     if (compute)
                       {
@@ -1986,7 +1986,7 @@ public:
                     Stack.push(tmp_out.str());
                   }
                   break;
-                case ExternalFunctionSecondDerivative:
+                case ExternalFunctionType::secondDerivative:
                   {
                     if (compute)
                       {
@@ -2043,13 +2043,13 @@ public:
             tmp_out.str("");
             switch (function_type)
               {
-              case ExternalFunctionWithoutDerivative:
+              case ExternalFunctionType::withoutDerivative:
                 tmp_out << "TEF(" << var << ") = " << Stack.top();
                 break;
-              case ExternalFunctionWithFirstDerivative:
+              case ExternalFunctionType::withFirstDerivative:
                 tmp_out << "[TEF(" << var << "), TEFD(" << var << ") ]= " << Stack.top();
                 break;
-              case ExternalFunctionWithFirstandSecondDerivative:
+              case ExternalFunctionType::withFirstAndSecondDerivative:
                 tmp_out << "[TEF(" << var << "), TEFD(" << var << "), TEFDD(" << var << ") ]= " << Stack.top();
                 break;
               default:
@@ -2105,9 +2105,9 @@ public:
                   Stackf.pop();
                 }
               tmp_out.str("");
-              if (function_type == ExternalFunctionNumericalFirstDerivative)
+              if (function_type == ExternalFunctionType::numericalFirstDerivative)
                 tmp_out << "TEFD(" << indx << ", " << row << ") = " << Stack.top();
-              else if (function_type == ExternalFunctionFirstDerivative)
+              else if (function_type == ExternalFunctionType::firstDerivative)
                 tmp_out << "TEFD(" << indx << ") = " << Stack.top();
               Stack.pop();
             }
@@ -2155,9 +2155,9 @@ public:
                   Stackf.pop();
                 }
               tmp_out.str("");
-              if (function_type == ExternalFunctionNumericalSecondDerivative)
+              if (function_type == ExternalFunctionType::numericalSecondDerivative)
                 tmp_out << "TEFDD(" << indx << ", " << row << ", " << col << ") = " << Stack.top();
-              else if (function_type == ExternalFunctionSecondDerivative)
+              else if (function_type == ExternalFunctionType::secondDerivative)
                 tmp_out << "TEFDD(" << indx << ") = " << Stack.top();
               Stack.pop();
             }
diff --git a/mex/sources/bytecode/Evaluate.cc b/mex/sources/bytecode/Evaluate.cc
index 16b4e4d228bb21da1759bf4abb65c59b901cf931..5693ba0a41213d89627e06ea2a72a33b3081fc63 100644
--- a/mex/sources/bytecode/Evaluate.cc
+++ b/mex/sources/bytecode/Evaluate.cc
@@ -120,7 +120,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
   double *jacob = NULL, *jacob_other_endo = NULL, *jacob_exo = NULL, *jacob_exo_det = NULL;
   EQN_block = block_num;
   stack<double> Stack;
-  external_function_type function_type = ExternalFunctionWithoutDerivative;
+  ExternalFunctionType function_type = ExternalFunctionType::withoutDerivative;
 
 #ifdef DEBUG
   mexPrintf("compute_block_time\n");
@@ -310,9 +310,9 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
           break;
         case FLDV:
           //load a variable in the processor
-          switch (((FLDV_ *) it_code->second)->get_type())
+          switch (static_cast<SymbolType>(((FLDV_ *) it_code->second)->get_type()))
             {
-            case eParameter:
+            case SymbolType::parameter:
               var = ((FLDV_ *) it_code->second)->get_pos();
 #ifdef DEBUG
               mexPrintf("FLDV Param[var=%d]\n", var);
@@ -320,7 +320,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
 #endif
               Stack.push(params[var]);
               break;
-            case eEndogenous:
+            case SymbolType::endogenous:
               var = ((FLDV_ *) it_code->second)->get_pos();
               lag = ((FLDV_ *) it_code->second)->get_lead_lag();
 #ifdef DEBUG
@@ -337,7 +337,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
               tmp_out << " y[" << it_+lag << ", " << var << "](" << y[(it_+lag)*y_size+var] << ")";
 #endif
               break;
-            case eExogenous:
+            case SymbolType::exogenous:
               var = ((FLDV_ *) it_code->second)->get_pos();
               lag = ((FLDV_ *) it_code->second)->get_lead_lag();
 #ifdef DEBUG
@@ -346,12 +346,12 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
 #endif
               Stack.push(x[it_+lag+var*nb_row_x]);
               break;
-            case eExogenousDet:
+            case SymbolType::exogenousDet:
               var = ((FLDV_ *) it_code->second)->get_pos();
               lag = ((FLDV_ *) it_code->second)->get_lead_lag();
               Stack.push(x[it_+lag+var*nb_row_xd]);
               break;
-            case eModelLocalVariable:
+            case SymbolType::modelLocalVariable:
 #ifdef DEBUG
               mexPrintf("FLDV a local variable in Block %d Stack.size()=%d", block_num, Stack.size());
               mexPrintf(" value=%f\n", Stack.top());
@@ -363,9 +363,9 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
           break;
         case FLDSV:
           //load a variable in the processor
-          switch (((FLDSV_ *) it_code->second)->get_type())
+          switch (static_cast<SymbolType>(((FLDSV_ *) it_code->second)->get_type()))
             {
-            case eParameter:
+            case SymbolType::parameter:
               var = ((FLDSV_ *) it_code->second)->get_pos();
 #ifdef DEBUG
               mexPrintf("FLDSV Param[var=%d]=%f\n", var, params[var]);
@@ -373,7 +373,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
 #endif
               Stack.push(params[var]);
               break;
-            case eEndogenous:
+            case SymbolType::endogenous:
               var = ((FLDSV_ *) it_code->second)->get_pos();
 #ifdef DEBUG
               mexPrintf("FLDSV y[var=%d]=%f\n", var, ya[var]);
@@ -384,7 +384,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
               else
                 Stack.push(y[var]);
               break;
-            case eExogenous:
+            case SymbolType::exogenous:
               var = ((FLDSV_ *) it_code->second)->get_pos();
 #ifdef DEBUG
               mexPrintf("FLDSV x[var=%d]\n", var);
@@ -392,14 +392,14 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
 #endif
               Stack.push(x[var]);
               break;
-            case eExogenousDet:
+            case SymbolType::exogenousDet:
               var = ((FLDSV_ *) it_code->second)->get_pos();
 #ifdef DEBUG
               mexPrintf("FLDSV xd[var=%d]\n", var);
 #endif
               Stack.push(x[var]);
               break;
-            case eModelLocalVariable:
+            case SymbolType::modelLocalVariable:
 #ifdef DEBUG
               mexPrintf("FLDSV a local variable in Block %d Stack.size()=%d", block_num, Stack.size());
               mexPrintf(" value=%f\n", Stack.top());
@@ -411,37 +411,37 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
           break;
         case FLDVS:
           //load a variable in the processor
-          switch (((FLDVS_ *) it_code->second)->get_type())
+          switch (static_cast<SymbolType>(((FLDVS_ *) it_code->second)->get_type()))
             {
-            case eParameter:
+            case SymbolType::parameter:
               var = ((FLDVS_ *) it_code->second)->get_pos();
 #ifdef DEBUG
               mexPrintf("params[%d]\n", var);
 #endif
               Stack.push(params[var]);
               break;
-            case eEndogenous:
+            case SymbolType::endogenous:
               var = ((FLDVS_ *) it_code->second)->get_pos();
 #ifdef DEBUG
               mexPrintf("FLDVS steady_y[%d]\n", var);
 #endif
               Stack.push(steady_y[var]);
               break;
-            case eExogenous:
+            case SymbolType::exogenous:
               var = ((FLDVS_ *) it_code->second)->get_pos();
 #ifdef DEBUG
               mexPrintf("FLDVS x[%d] \n", var);
 #endif
               Stack.push(x[var]);
               break;
-            case eExogenousDet:
+            case SymbolType::exogenousDet:
               var = ((FLDVS_ *) it_code->second)->get_pos();
 #ifdef DEBUG
               mexPrintf("FLDVS xd[%d]\n", var);
 #endif
               Stack.push(x[var]);
               break;
-            case eModelLocalVariable:
+            case SymbolType::modelLocalVariable:
 #ifdef DEBUG
               mexPrintf("FLDVS a local variable in Block %d Stack.size()=%d", block_num, Stack.size());
               mexPrintf(" value=%f\n", Stack.top());
@@ -521,9 +521,9 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
           break;
         case FSTPV:
           //load a variable in the processor
-          switch (((FSTPV_ *) it_code->second)->get_type())
+          switch (static_cast<SymbolType>(((FSTPV_ *) it_code->second)->get_type()))
             {
-            case eParameter:
+            case SymbolType::parameter:
               var = ((FSTPV_ *) it_code->second)->get_pos();
 #ifdef DEBUG
               mexPrintf("FSTPV params[%d]\n", var);
@@ -531,7 +531,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
               params[var] = Stack.top();
               Stack.pop();
               break;
-            case eEndogenous:
+            case SymbolType::endogenous:
               var = ((FSTPV_ *) it_code->second)->get_pos();
               lag = ((FSTPV_ *) it_code->second)->get_lead_lag();
               y[(it_+lag)*y_size+var] = Stack.top();
@@ -542,7 +542,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
 #endif
               Stack.pop();
               break;
-            case eExogenous:
+            case SymbolType::exogenous:
               var = ((FSTPV_ *) it_code->second)->get_pos();
               lag = ((FSTPV_ *) it_code->second)->get_lead_lag();
               x[it_+lag+var*nb_row_x]  = Stack.top();
@@ -554,7 +554,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
 
               Stack.pop();
               break;
-            case eExogenousDet:
+            case SymbolType::exogenousDet:
               var = ((FSTPV_ *) it_code->second)->get_pos();
               lag = ((FSTPV_ *) it_code->second)->get_lead_lag();
               x[it_+lag+var*nb_row_xd] = Stack.top();
@@ -571,14 +571,14 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
           break;
         case FSTPSV:
           //load a variable in the processor
-          switch (((FSTPSV_ *) it_code->second)->get_type())
+          switch (static_cast<SymbolType>(((FSTPSV_ *) it_code->second)->get_type()))
             {
-            case eParameter:
+            case SymbolType::parameter:
               var = ((FSTPSV_ *) it_code->second)->get_pos();
               params[var] = Stack.top();
               Stack.pop();
               break;
-            case eEndogenous:
+            case SymbolType::endogenous:
               var = ((FSTPSV_ *) it_code->second)->get_pos();
               y[var] = Stack.top();
 #ifdef DEBUG
@@ -588,8 +588,8 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
 #endif
               Stack.pop();
               break;
-            case eExogenous:
-            case eExogenousDet:
+            case SymbolType::exogenous:
+            case SymbolType::exogenousDet:
               var = ((FSTPSV_ *) it_code->second)->get_pos();
               x[var]  = Stack.top();
 #ifdef DEBUG
@@ -800,27 +800,27 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
           Stack.pop();
           v1 = Stack.top();
           Stack.pop();
-          switch (op)
+          switch (static_cast<BinaryOpcode>(op))
             {
-            case oPlus:
+            case BinaryOpcode::plus:
               Stack.push(v1 + v2);
 #ifdef DEBUG
               tmp_out << " |" << v1 << "+" << v2 << "|";
 #endif
               break;
-            case oMinus:
+            case BinaryOpcode::minus:
               Stack.push(v1 - v2);
 #ifdef DEBUG
               tmp_out << " |" << v1 << "-" << v2 << "|";
 #endif
               break;
-            case oTimes:
+            case BinaryOpcode::times:
               Stack.push(v1 * v2);
 #ifdef DEBUG
               tmp_out << " |" << v1 << "*" << v2 << "|";
 #endif
               break;
-            case oDivide:
+            case BinaryOpcode::divide:
               double tmp;
 #ifdef DEBUG
               mexPrintf("v1=%f / v2=%f\n", v1, v2);
@@ -839,43 +839,43 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
               tmp_out << " |" << v1 << "/" << v2 << "|";
 #endif
               break;
-            case oLess:
+            case BinaryOpcode::less:
               Stack.push(double (v1 < v2));
 #ifdef DEBUG
               mexPrintf("v1=%f v2=%f v1 < v2 = %f\n", v1, v2, double (v1 < v2));
 #endif
               break;
-            case oGreater:
+            case BinaryOpcode::greater:
               Stack.push(double (v1 > v2));
 #ifdef DEBUG
               tmp_out << " |" << v1 << ">" << v2 << "|";
 #endif
               break;
-            case oLessEqual:
+            case BinaryOpcode::lessEqual:
               Stack.push(double (v1 <= v2));
 #ifdef DEBUG
               tmp_out << " |" << v1 << "<=" << v2 << "|";
 #endif
               break;
-            case oGreaterEqual:
+            case BinaryOpcode::greaterEqual:
               Stack.push(double (v1 >= v2));
 #ifdef DEBUG
               tmp_out << " |" << v1 << ">=" << v2 << "|";
 #endif
               break;
-            case oEqualEqual:
+            case BinaryOpcode::equalEqual:
               Stack.push(double (v1 == v2));
 #ifdef DEBUG
               tmp_out << " |" << v1 << "==" << v2 << "|";
 #endif
               break;
-            case oDifferent:
+            case BinaryOpcode::different:
               Stack.push(double (v1 != v2));
 #ifdef DEBUG
               tmp_out << " |" << v1 << "!=" << v2 << "|";
 #endif
               break;
-            case oPower:
+            case BinaryOpcode::power:
 #ifdef DEBUG
               mexPrintf("pow\n");
 #endif
@@ -894,15 +894,15 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
               tmp_out << " |" << v1 << "^" << v2 << "|";
 #endif
               break;
-            case oPowerDeriv:
+            case BinaryOpcode::powerDeriv:
               {
                 int derivOrder = int (nearbyint(Stack.top()));
                 Stack.pop();
                 try
                   {
-                    if (fabs(v1) < NEAR_ZERO && v2 > 0
+                    if (fabs(v1) < near_zero && v2 > 0
                         && derivOrder > v2
-                        && fabs(v2-nearbyint(v2)) < NEAR_ZERO)
+                        && fabs(v2-nearbyint(v2)) < near_zero)
                       Stack.push(0.0);
                     else
                       {
@@ -923,19 +923,19 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
               tmp_out << " |PowerDeriv(" << v1 << ", " << v2 << ")|";
 #endif
               break;
-            case oMax:
+            case BinaryOpcode::max:
               Stack.push(max(v1, v2));
 #ifdef DEBUG
               tmp_out << " |max(" << v1 << "," << v2 << ")|";
 #endif
               break;
-            case oMin:
+            case BinaryOpcode::min:
               Stack.push(min(v1, v2));
 #ifdef DEBUG
               tmp_out << " |min(" << v1 << "," << v2 << ")|";
 #endif
               break;
-            case oEqual:
+            case BinaryOpcode::equal:
               // Nothing to do
               break;
             default:
@@ -954,22 +954,22 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
 #ifdef DEBUG
           mexPrintf("FUNARY, op=%d\n", op);
 #endif
-          switch (op)
+          switch (static_cast<UnaryOpcode>(op))
             {
-            case oUminus:
+            case UnaryOpcode::uminus:
               Stack.push(-v1);
 #ifdef DEBUG
               tmp_out << " |-(" << v1 << ")|";
 #endif
 
               break;
-            case oExp:
+            case UnaryOpcode::exp:
               Stack.push(exp(v1));
 #ifdef DEBUG
               tmp_out << " |exp(" << v1 << ")|";
 #endif
               break;
-            case oLog:
+            case UnaryOpcode::log:
               double tmp;
               try
                 {
@@ -987,7 +987,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
               tmp_out << " |log(" << v1 << ")|";
 #endif
               break;
-            case oLog10:
+            case UnaryOpcode::log10:
               try
                 {
                   tmp = log10_1(v1);
@@ -1002,85 +1002,85 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
               tmp_out << " |log10(" << v1 << ")|";
 #endif
               break;
-            case oCos:
+            case UnaryOpcode::cos:
               Stack.push(cos(v1));
 #ifdef DEBUG
               tmp_out << " |cos(" << v1 << ")|";
 #endif
               break;
-            case oSin:
+            case UnaryOpcode::sin:
               Stack.push(sin(v1));
 #ifdef DEBUG
               tmp_out << " |sin(" << v1 << ")|";
 #endif
               break;
-            case oTan:
+            case UnaryOpcode::tan:
               Stack.push(tan(v1));
 #ifdef DEBUG
               tmp_out << " |tan(" << v1 << ")|";
 #endif
               break;
-            case oAcos:
+            case UnaryOpcode::acos:
               Stack.push(acos(v1));
 #ifdef DEBUG
               tmp_out << " |acos(" << v1 << ")|";
 #endif
               break;
-            case oAsin:
+            case UnaryOpcode::asin:
               Stack.push(asin(v1));
 #ifdef DEBUG
               tmp_out << " |asin(" << v1 << ")|";
 #endif
               break;
-            case oAtan:
+            case UnaryOpcode::atan:
               Stack.push(atan(v1));
 #ifdef DEBUG
               tmp_out << " |atan(" << v1 << ")|";
 #endif
               break;
-            case oCosh:
+            case UnaryOpcode::cosh:
               Stack.push(cosh(v1));
 #ifdef DEBUG
               tmp_out << " |cosh(" << v1 << ")|";
 #endif
               break;
-            case oSinh:
+            case UnaryOpcode::sinh:
               Stack.push(sinh(v1));
 #ifdef DEBUG
               tmp_out << " |sinh(" << v1 << ")|";
 #endif
               break;
-            case oTanh:
+            case UnaryOpcode::tanh:
               Stack.push(tanh(v1));
 #ifdef DEBUG
               tmp_out << " |tanh(" << v1 << ")|";
 #endif
               break;
-            case oAcosh:
+            case UnaryOpcode::acosh:
               Stack.push(acosh(v1));
 #ifdef DEBUG
               tmp_out << " |acosh(" << v1 << ")|";
 #endif
               break;
-            case oAsinh:
+            case UnaryOpcode::asinh:
               Stack.push(asinh(v1));
 #ifdef DEBUG
               tmp_out << " |asinh(" << v1 << ")|";
 #endif
               break;
-            case oAtanh:
+            case UnaryOpcode::atanh:
               Stack.push(atanh(v1));
 #ifdef DEBUG
               tmp_out << " |atanh(" << v1 << ")|";
 #endif
               break;
-            case oSqrt:
+            case UnaryOpcode::sqrt:
               Stack.push(sqrt(v1));
 #ifdef DEBUG
               tmp_out << " |sqrt(" << v1 << ")|";
 #endif
               break;
-            case oErf:
+            case UnaryOpcode::erf:
               Stack.push(erf(v1));
 #ifdef DEBUG
               tmp_out << " |erf(" << v1 << ")|";
@@ -1104,15 +1104,15 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
           Stack.pop();
           v1 = Stack.top();
           Stack.pop();
-          switch (op)
+          switch (static_cast<TrinaryOpcode>(op))
             {
-            case oNormcdf:
+            case TrinaryOpcode::normcdf:
               Stack.push(0.5*(1+erf((v1-v2)/v3/M_SQRT2)));
 #ifdef DEBUG
               tmp_out << " |normcdf(" << v1 << ", " << v2 << ", " << v3 << ")|";
 #endif
               break;
-            case oNormpdf:
+            case TrinaryOpcode::normpdf:
               Stack.push(1/(v3*sqrt(2*M_PI)*exp(pow((v1-v2)/v3, 2)/2)));
 #ifdef DEBUG
               tmp_out << " |normpdf(" << v1 << ", " << v2 << ", " << v3 << ")|";
@@ -1166,9 +1166,9 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
             mxArray **input_arguments;
             switch (function_type)
               {
-              case ExternalFunctionWithoutDerivative:
-              case ExternalFunctionWithFirstDerivative:
-              case ExternalFunctionWithFirstandSecondDerivative:
+              case ExternalFunctionType::withoutDerivative:
+              case ExternalFunctionType::withFirstDerivative:
+              case ExternalFunctionType::withFirstAndSecondDerivative:
                 {
                   input_arguments = (mxArray **) mxMalloc(nb_input_arguments * sizeof(mxArray *));
                   test_mxMalloc(input_arguments, __LINE__, __FILE__, __func__, nb_input_arguments * sizeof(mxArray *));
@@ -1191,7 +1191,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
 
                   double *rr = mxGetPr(output_arguments[0]);
                   Stack.push(*rr);
-                  if (function_type == ExternalFunctionWithFirstDerivative || function_type == ExternalFunctionWithFirstandSecondDerivative)
+                  if (function_type == ExternalFunctionType::withFirstDerivative || function_type == ExternalFunctionType::withFirstAndSecondDerivative)
                     {
                       unsigned int indx = fc->get_indx();
                       double *FD1 = mxGetPr(output_arguments[1]);
@@ -1199,7 +1199,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
                       for (unsigned int i = 0; i < rows; i++)
                         TEFD[make_pair(indx, i)] = FD1[i];
                     }
-                  if (function_type == ExternalFunctionWithFirstandSecondDerivative)
+                  if (function_type == ExternalFunctionType::withFirstAndSecondDerivative)
                     {
                       unsigned int indx = fc->get_indx();
                       double *FD2 = mxGetPr(output_arguments[2]);
@@ -1212,7 +1212,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
                     }
                 }
                 break;
-              case ExternalFunctionNumericalFirstDerivative:
+              case ExternalFunctionType::numericalFirstDerivative:
                 {
                   input_arguments = (mxArray **) mxMalloc((nb_input_arguments+1+nb_add_input_arguments) * sizeof(mxArray *));
                   test_mxMalloc(input_arguments, __LINE__, __FILE__, __func__, (nb_input_arguments+1+nb_add_input_arguments) * sizeof(mxArray *));
@@ -1252,7 +1252,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
                   Stack.push(*rr);
                 }
                 break;
-              case ExternalFunctionFirstDerivative:
+              case ExternalFunctionType::firstDerivative:
                 {
                   input_arguments = (mxArray **) mxMalloc(nb_input_arguments * sizeof(mxArray *));
                   test_mxMalloc(input_arguments, __LINE__, __FILE__, __func__, nb_input_arguments * sizeof(mxArray *));
@@ -1276,7 +1276,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
                     TEFD[make_pair(indx, i)] = FD1[i];
                 }
                 break;
-              case ExternalFunctionNumericalSecondDerivative:
+              case ExternalFunctionType::numericalSecondDerivative:
                 {
                   input_arguments = (mxArray **) mxMalloc((nb_input_arguments+1+nb_add_input_arguments) * sizeof(mxArray *));
                   test_mxMalloc(input_arguments, __LINE__, __FILE__, __func__, (nb_input_arguments+1+nb_add_input_arguments) * sizeof(mxArray *));
@@ -1315,7 +1315,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
                   Stack.push(*rr);
                 }
                 break;
-              case ExternalFunctionSecondDerivative:
+              case ExternalFunctionType::secondDerivative:
                 {
                   input_arguments = (mxArray **) mxMalloc(nb_input_arguments * sizeof(mxArray *));
                   test_mxMalloc(input_arguments, __LINE__, __FILE__, __func__, nb_input_arguments * sizeof(mxArray *));
@@ -1375,7 +1375,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
             mexPrintf("FSTPTEFD\n");
             mexPrintf("indx=%d Stack.size()=%d\n", indx, Stack.size());
 #endif
-            if (function_type == ExternalFunctionNumericalFirstDerivative)
+            if (function_type == ExternalFunctionType::numericalFirstDerivative)
               {
                 TEFD[make_pair(indx, row-1)] = Stack.top();
 #ifdef DEBUG
@@ -1409,7 +1409,7 @@ Evaluate::compute_block_time(const int Per_u_, const bool evaluate, /*const int
             mexPrintf("FSTPTEFD\n");
             mexPrintf("indx=%d Stack.size()=%d\n", indx, Stack.size());
 #endif
-            if (function_type == ExternalFunctionNumericalSecondDerivative)
+            if (function_type == ExternalFunctionType::numericalSecondDerivative)
               {
                 TEFDD[make_pair(indx, make_pair(row-1, col-1))] = Stack.top();
 #ifdef DEBUG
diff --git a/mex/sources/bytecode/Interpreter.cc b/mex/sources/bytecode/Interpreter.cc
index bb986cff8d0d1d492d7cdb240a9a845634a253d6..a3762c9bbc5307d18d9db5331aff976ab579d765 100644
--- a/mex/sources/bytecode/Interpreter.cc
+++ b/mex/sources/bytecode/Interpreter.cc
@@ -609,7 +609,7 @@ Interpreter::check_for_controlled_exo_validity(FBEGINBLOCK_ *fb, vector<s_plan>
       if ((find(endogenous.begin(), endogenous.end(), it->exo_num) != endogenous.end()) &&  (find(exogenous.begin(), exogenous.end(), it->var_num) == exogenous.end()))
         {
           ostringstream tmp;
-          tmp << "\n the conditional forecast involving as constrained variable " << get_variable(eEndogenous, it->exo_num) << " and as endogenized exogenous " << get_variable(eExogenous, it->var_num) << " that do not appear in block=" << Block_Count+1 << ")\n You should not use block in model options\n";
+          tmp << "\n the conditional forecast involving as constrained variable " << get_variable(SymbolType::endogenous, it->exo_num) << " and as endogenized exogenous " << get_variable(SymbolType::exogenous, it->var_num) << " that do not appear in block=" << Block_Count+1 << ")\n You should not use block in model options\n";
           throw FatalExceptionHandling(tmp.str());
         }
       else if ((find(endogenous.begin(), endogenous.end(), it->exo_num) != endogenous.end()) &&  (find(exogenous.begin(), exogenous.end(), it->var_num) != exogenous.end()) && ((fb->get_type() == EVALUATE_FORWARD) || (fb->get_type() != EVALUATE_BACKWARD)))
@@ -621,7 +621,7 @@ Interpreter::check_for_controlled_exo_validity(FBEGINBLOCK_ *fb, vector<s_plan>
       else if (find(previous_block_exogenous.begin(), previous_block_exogenous.end(), it->var_num) != previous_block_exogenous.end())
         {
           ostringstream tmp;
-          tmp << "\n the conditional forecast involves in the block " << Block_Count+1 << " the endogenized exogenous " << get_variable(eExogenous, it->var_num) << " that appear also in a previous block\n You should not use block in model options\n";
+          tmp << "\n the conditional forecast involves in the block " << Block_Count+1 << " the endogenized exogenous " << get_variable(SymbolType::exogenous, it->var_num) << " that appear also in a previous block\n You should not use block in model options\n";
           throw FatalExceptionHandling(tmp.str());
         }
     }
diff --git a/mex/sources/bytecode/bytecode.cc b/mex/sources/bytecode/bytecode.cc
index 2bac3e3f27f5b4bc64e243de0efc8f46421484ac..daa6de10d1928aa10372656b532e91429a5f809e 100644
--- a/mex/sources/bytecode/bytecode.cc
+++ b/mex/sources/bytecode/bytecode.cc
@@ -729,9 +729,9 @@ main(int nrhs, const char *prhs[])
               char name [100];
               mxGetString(tmp, name, 100);
               splan[i].var = name;
-              SymbolType variable_type = eEndogenous;
+              SymbolType variable_type = SymbolType::endogenous;
               int exo_num = emsg.get_ID(name, &variable_type);
-              if (variable_type == eExogenous || variable_type == eExogenousDet)
+              if (variable_type == SymbolType::exogenous || variable_type == SymbolType::exogenousDet)
                 splan[i].var_num = exo_num;
               else
                 {
@@ -749,7 +749,7 @@ main(int nrhs, const char *prhs[])
               splan[i].exo = name;
               SymbolType variable_type;
               int exo_num = emsg.get_ID(name, &variable_type);
-              if (variable_type == eEndogenous)
+              if (variable_type == SymbolType::endogenous)
                 splan[i].exo_num = exo_num;
               else
                 {
@@ -807,9 +807,9 @@ main(int nrhs, const char *prhs[])
               char name [100];
               mxGetString(tmp, name, 100);
               spfplan[i].var = name;
-              SymbolType variable_type = eEndogenous;
+              SymbolType variable_type = SymbolType::endogenous;
               int exo_num = emsg.get_ID(name, &variable_type);
-              if (variable_type == eExogenous || variable_type == eExogenousDet)
+              if (variable_type == SymbolType::exogenous || variable_type == SymbolType::exogenousDet)
                 splan[i].var_num = exo_num;
               else
                 {
@@ -827,7 +827,7 @@ main(int nrhs, const char *prhs[])
               spfplan[i].exo = name;
               SymbolType variable_type;
               int exo_num = emsg.get_ID(name, &variable_type);
-              if (variable_type == eEndogenous)
+              if (variable_type == SymbolType::endogenous)
                 spfplan[i].exo_num = exo_num;
               else
                 {
diff --git a/preprocessor b/preprocessor
index 3776e3b890a137e690008a59a8552cc4eaa47a3d..4a04a383744a7769f7f20838168eeb808553655c 160000
--- a/preprocessor
+++ b/preprocessor
@@ -1 +1 @@
-Subproject commit 3776e3b890a137e690008a59a8552cc4eaa47a3d
+Subproject commit 4a04a383744a7769f7f20838168eeb808553655c