diff --git a/mex/sources/bytecode/Interpreter.cc b/mex/sources/bytecode/Interpreter.cc
index 33c2b994d2295fbe2241a408ec0cb3a1a8fb6463..ca221d0154e545906b7b87cbc8c7538bcb6c49de 100644
--- a/mex/sources/bytecode/Interpreter.cc
+++ b/mex/sources/bytecode/Interpreter.cc
@@ -30,8 +30,8 @@ constexpr double BIG = 1.0e+8, SMALL = 1.0e-5;
 Interpreter::Interpreter(Evaluate &evaluator_arg, double *params_arg, double *y_arg, double *ya_arg, double *x_arg, double *steady_y_arg,
                          double *direction_arg, int y_size_arg,
                          int nb_row_x_arg, int periods_arg, int y_kmin_arg, int y_kmax_arg,
-                         int maxit_arg_, double solve_tolf_arg, int y_decal_arg, double markowitz_c_arg,
-                         string &filename_arg, int minimal_solving_periods_arg, int stack_solve_algo_arg, int solve_algo_arg,
+                         int maxit_arg_, double solve_tolf_arg, double markowitz_c_arg,
+                         int minimal_solving_periods_arg, int stack_solve_algo_arg, int solve_algo_arg,
                          bool global_temporary_terms_arg, bool print_arg, mxArray *GlobalTemporaryTerms_arg,
                          bool steady_state_arg, bool block_decomposed_arg, int col_x_arg, int col_y_arg, const BasicSymbolTable &symbol_table_arg, int verbosity_arg)
 : dynSparseMatrix {evaluator_arg, y_size_arg, y_kmin_arg, y_kmax_arg, steady_state_arg, block_decomposed_arg, periods_arg, minimal_solving_periods_arg, symbol_table_arg, verbosity_arg}
@@ -48,9 +48,7 @@ Interpreter::Interpreter(Evaluate &evaluator_arg, double *params_arg, double *y_
   solve_tolf = solve_tolf_arg;
   slowc = 1;
   slowc_save = 1;
-  y_decal = y_decal_arg;
   markowitz_c = markowitz_c_arg;
-  filename = filename_arg;
   T = nullptr;
   minimal_solving_periods = minimal_solving_periods_arg;
   stack_solve_algo = stack_solve_algo_arg;
diff --git a/mex/sources/bytecode/Interpreter.hh b/mex/sources/bytecode/Interpreter.hh
index 03ab263604e597519ac1b4b801d80bd44a258edd..7dacfbe7e2117bc8df02f7d9be0a468cda9c3904 100644
--- a/mex/sources/bytecode/Interpreter.hh
+++ b/mex/sources/bytecode/Interpreter.hh
@@ -54,8 +54,8 @@ public:
   Interpreter(Evaluate &evaluator_arg, double *params_arg, double *y_arg, double *ya_arg, double *x_arg, double *steady_y_arg,
               double *direction_arg, int y_size_arg,
               int nb_row_x_arg, int periods_arg, int y_kmin_arg, int y_kmax_arg,
-              int maxit_arg_, double solve_tolf_arg, int y_decal_arg, double markowitz_c_arg,
-              string &filename_arg, int minimal_solving_periods_arg, int stack_solve_algo_arg, int solve_algo_arg,
+              int maxit_arg_, double solve_tolf_arg, double markowitz_c_arg,
+              int minimal_solving_periods_arg, int stack_solve_algo_arg, int solve_algo_arg,
               bool global_temporary_terms_arg, bool print_arg, mxArray *GlobalTemporaryTerms_arg,
               bool steady_state_arg, bool block_decomposed_arg, int col_x_arg, int col_y_arg, const BasicSymbolTable &symbol_table_arg, int verbosity_arg);
   pair<bool, vector<int>> extended_path(const string &file_name, bool evaluate, int block, int nb_periods, const vector<s_plan> &sextended_path, const vector<s_plan> &sconstrained_extended_path, const vector<string> &dates, const table_conditional_global_type &table_conditional_global);
diff --git a/mex/sources/bytecode/SparseMatrix.cc b/mex/sources/bytecode/SparseMatrix.cc
index f0268beb533f29e66ffaecdcbcb1b6a1a60045f0..fca24529a20f0e157e88eeda030efa1fedb8dbd8 100644
--- a/mex/sources/bytecode/SparseMatrix.cc
+++ b/mex/sources/bytecode/SparseMatrix.cc
@@ -39,14 +39,10 @@ dynSparseMatrix::dynSparseMatrix(Evaluate &evaluator_arg, int y_size_arg, int y_
   verbosity {verbosity_arg}
 {
   pivotva = nullptr;
-  g_save_op = nullptr;
-  g_nop_all = 0;
   mem_mngr.init_Mem();
   symbolic = true;
   alt_symbolic = false;
   alt_symbolic_count = 0;
-  max_u = 0;
-  min_u = 0x7FFFFFFF;
   res1a = 9.0e60;
   tbreak_g = 0;
   start_compare = 0;
@@ -358,8 +354,6 @@ dynSparseMatrix::Simple_Init(int Size, const map<tuple<int, int, int>, int> &IM,
   test_mxMalloc(line_done, __LINE__, __FILE__, __func__, Size*sizeof(bool));
 
   mem_mngr.init_CHUNK_BLCK_SIZE(u_count);
-  g_save_op = nullptr;
-  g_nop_all = 0;
   int i = Size*sizeof(NonZeroElem *);
   FNZE_R = static_cast<NonZeroElem **>(mxMalloc(i));
   test_mxMalloc(FNZE_R, __LINE__, __FILE__, __func__, i);
@@ -980,8 +974,6 @@ dynSparseMatrix::Init_GE(int periods, int y_kmin, int y_kmax, int Size, const ma
   line_done = static_cast<bool *>(mxMalloc(Size*periods*sizeof(bool)));
   test_mxMalloc(line_done, __LINE__, __FILE__, __func__, Size*periods*sizeof(bool));
   mem_mngr.init_CHUNK_BLCK_SIZE(u_count);
-  g_save_op = nullptr;
-  g_nop_all = 0;
   int i = (periods+y_kmax+1)*Size*sizeof(NonZeroElem *);
   FNZE_R = static_cast<NonZeroElem **>(mxMalloc(i));
   test_mxMalloc(FNZE_R, __LINE__, __FILE__, __func__, i);
@@ -3570,7 +3562,6 @@ dynSparseMatrix::Solve_ByteCode_Symbolic_Sparse_GaussianElimination(int Size, bo
                     }
                 }
             }
-          nop2 = nop1;
           nop1 = nop;
         }
     }
@@ -3579,7 +3570,6 @@ dynSparseMatrix::Solve_ByteCode_Symbolic_Sparse_GaussianElimination(int Size, bo
   mxFree(pivj_v);
   mxFree(pivk_v);
   mxFree(NR);
-  nop_all += nop;
   if (symbolic)
     {
       if (save_op)
@@ -3746,8 +3736,6 @@ dynSparseMatrix::Simulate_One_Boundary(int block_num, int y_size, int size)
           if (!A_m)
             throw FatalException{"In Simulate_One_Boundary, can't allocate A_m matrix"};
           Init_Matlab_Sparse_Simple(size, IM_i, A_m, b_m, zero_solution, x0_m);
-          A_m_save = mxDuplicateArray(A_m);
-          b_m_save = mxDuplicateArray(b_m);
         }
       else
         {
diff --git a/mex/sources/bytecode/SparseMatrix.hh b/mex/sources/bytecode/SparseMatrix.hh
index 89f3c08a659a61f28ca76bee6064e358a123d408..8aa4d067ba62725dfa972fdcc2531c565c3eca79 100644
--- a/mex/sources/bytecode/SparseMatrix.hh
+++ b/mex/sources/bytecode/SparseMatrix.hh
@@ -145,17 +145,10 @@ protected:
 
   Evaluate &evaluator;
 
-  stack<double> Stack;
-  int nb_prologue_table_u, nb_first_table_u, nb_middle_table_u, nb_last_table_u;
-  int nb_prologue_table_y, nb_first_table_y, nb_middle_table_y, nb_last_table_y;
-  int middle_count_loop;
   fstream SaveCode;
-  string filename;
-  int max_u, min_u;
 
   Mem_Mngr mem_mngr;
   vector<int> u_liste;
-  map<pair<int, int>, NonZeroElem *> Mapped_Array;
   int *NbNZRow, *NbNZCol;
   NonZeroElem **FNZE_R, **FNZE_C;
   int u_count_init;
@@ -166,29 +159,21 @@ protected:
   bool *line_done;
   bool symbolic, alt_symbolic;
   int alt_symbolic_count;
-  int *g_save_op;
-  int first_count_loop;
-  int g_nop_all;
   double markowitz_c_s;
   double res1a;
-  long int nop_all, nop1, nop2;
+  long int nop1;
   map<tuple<int, int, int>, int> IM_i;
   int u_count_alloc, u_count_alloc_save;
-  vector<double *> jac;
-  double *jcb;
   double slowc, slowc_save, prev_slowc_save, markowitz_c;
-  int y_decal;
-  int *index_equa;
+  int *index_equa; // Actually unused
   int u_count, tbreak_g;
   int iter;
   int start_compare;
   int restart;
-  double g_lambda1, g_lambda2, gp_0;
   double lu_inc_tol;
 
   SuiteSparse_long *Ap_save, *Ai_save;
   double *Ax_save, *b_save;
-  mxArray *A_m_save, *b_m_save;
 
   int stack_solve_algo, solve_algo;
   int minimal_solving_periods;
diff --git a/mex/sources/bytecode/bytecode.cc b/mex/sources/bytecode/bytecode.cc
index 5aec7371ab1e9be2bc05a98ae388e6f06ae149c7..accd4f5465db4d11ea73b46665df6087b29a1cea 100644
--- a/mex/sources/bytecode/bytecode.cc
+++ b/mex/sources/bytecode/bytecode.cc
@@ -180,7 +180,7 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
   mxArray *block_structur = nullptr;
   size_t i, row_y = 0, col_y = 0, row_x = 0, col_x = 0;
   size_t steady_row_y, steady_col_y;
-  int y_kmin = 0, y_kmax = 0, y_decal = 0;
+  int y_kmin = 0, y_kmax = 0;
   int periods {1};
   double *direction;
   bool steady_state = false;
@@ -385,11 +385,6 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
         y_kmax = static_cast<int>(floor(*(mxGetPr(mxGetFieldByNumber(M_, 0, field)))));
       else
         mexErrMsgTxt("maximum_lead is not a field of M_");
-      field = mxGetFieldNumber(M_, "maximum_endo_lag");
-      if (field >= 0)
-        y_decal = max(0, y_kmin-static_cast<int>(floor(*(mxGetPr(mxGetFieldByNumber(M_, 0, field))))));
-      else
-        mexErrMsgTxt("maximum_endo_lag is not a field of M_");
     }
 
   int field = mxGetFieldNumber(options_, "verbosity");
@@ -504,8 +499,8 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
   Evaluate evaluator {codfile, steady_state, symbol_table};
 
   Interpreter interprete {evaluator, params, y, ya, x, steady_yd, direction, static_cast<int>(row_y), static_cast<int>(row_x),
-                          periods, y_kmin, y_kmax, maxit_, solve_tolf, y_decal,
-                          markowitz_c, file_name, minimal_solving_periods, stack_solve_algo,
+                          periods, y_kmin, y_kmax, maxit_, solve_tolf,
+                          markowitz_c, minimal_solving_periods, stack_solve_algo,
                           solve_algo, global_temporary_terms, print, GlobalTemporaryTerms,
                           steady_state, block_decomposed, static_cast<int>(col_x), static_cast<int>(col_y), symbol_table, verbosity};
   bool r;