diff --git a/src/cluster/cluster.cpp b/src/cluster/cluster.cpp
index 9fa5af8d2d7d839e6c81649006cd07ad2150df01..bcf6f4240978bd4ac9fe6e66f7135ca59c1d50e1 100644
--- a/src/cluster/cluster.cpp
+++ b/src/cluster/cluster.cpp
@@ -356,35 +356,92 @@ void cluster(string config_file, string data_file, string output_path) {
 	// tppoan_2.open((output_path + "/c_TPPOAN_" + to_string(jxi488)).c_str(), ios::out | ios::binary);
 	double *gaps_2 = new double[nsph]();
 	double **tqse_2 = new double*[2];
+	double **tqce_2 = new double*[2];
+	double **tqcs_2 = new double*[2];
 	dcomplex **tqspe_2 = new dcomplex*[2];
+	dcomplex **tqcpe_2 = new dcomplex*[2];
+	dcomplex **tqcps_2 = new dcomplex*[2];
 	double **tqss_2 = new double*[2];
 	dcomplex **tqsps_2 = new dcomplex*[2];
 	for (int ti = 0; ti < 2; ti++) {
 	  tqse_2[ti] = new double[nsph]();
+	  tqce_2[ti] = new double[nsph]();
+	  tqcs_2[ti] = new double[nsph]();
 	  tqspe_2[ti] = new dcomplex[nsph]();
+	  tqcpe_2[ti] = new dcomplex[nsph]();
+	  tqcps_2[ti] = new dcomplex[nsph]();
 	  tqss_2[ti] = new double[nsph]();
 	  tqsps_2[ti] = new dcomplex[nsph]();
 	  for (int tj=0; tj<nsph; tj++) {
 	    tqse_2[ti][tj] = tqse[ti][tj];
+	    tqce_2[ti][tj] = tqce[ti][tj];
+	    tqcs_2[ti][tj] = tqcs[ti][tj];
 	    tqspe_2[ti][tj] = tqspe[ti][tj];
+	    tqcpe_2[ti][tj] = tqcpe[ti][tj];
+	    tqcps_2[ti][tj] = tqcps[ti][tj];
 	    tqss_2[ti][tj] = tqss[ti][tj];
 	    tqsps_2[ti][tj] = tqsps[ti][tj];
 	  }
 	}
 	double ****zpv_2 = new double***[c4->lm]; //[gconf->l_max][3][2][2]; // Matrix: dim[LM x 3 x 2 x 2]
-    for (int zi = 0; zi < c4->lm; zi++) {
-      zpv_2[zi] = new double**[3];
-      for (int zj = 0; zj < 3; zj++) {
-	zpv_2[zi][zj] = new double*[2];
-	for (int zk = 0; zk < 2; zk++) {
-	  zpv_2[zi][zj][zk] = new double[2]();
-	  for (int zl = 0; zl < 2; zl++) zpv_2[zi][zj][zk][zl] = zpv[zi][zj][zk][zl];
+	for (int zi = 0; zi < c4->lm; zi++) {
+	  zpv_2[zi] = new double**[3];
+	  for (int zj = 0; zj < 3; zj++) {
+	    zpv_2[zi][zj] = new double*[2];
+	    for (int zk = 0; zk < 2; zk++) {
+	      zpv_2[zi][zj][zk] = new double[2]();
+	      for (int zl = 0; zl < 2; zl++) zpv_2[zi][zj][zk][zl] = zpv[zi][zj][zk][zl];
+	    }
+	  }
 	}
-      }
-    }
-
-	
-	jer = cluster_jxi488_cycle(jxi488, sconf_2, gconf_2, c1_2, c1ao_2, c2_2, c3_2, c4_2, c6_2, c9_2, output, output_path, gaps_2, tqse_2, tqspe_2, tqss_2, tqsps_2, zpv_2, gapm, gappm, nth, nths, nph, nphs, nk, nks, nkks, argi, args, gap, gapp, tqce, tqcpe, tqcs, tqcps, duk, tppoan, cextlr, cext, cmullr, cmul, gapv, tqev, tqsv, nxi, nsph, mxndm, inpol, iavm, npnt, npntts, isam, lm, th, thstp, thlst, ths, thsstp, thslst, ph, phstp, phlst, phs, phsstp, phslst, th1, ph1, ths1, phs1, thsca, u, us, un, uns, up, ups, unmp, unsmp, upmp, upsmp, scan, cfmp, sfmp, cfsp, sfsp, sqsfi, exri, lcalc, arg, wn, vk, ndit, am, isq, ibf);
+	double **gapm_2 = new double*[3];
+	dcomplex **gappm_2 = new dcomplex*[3];
+	double **gap_2 = new double*[3];
+	dcomplex **gapp_2 = new dcomplex*[3];
+	for (int gi = 0; gi < 3; gi++) {
+	  gap_2[gi] = new double[2]();
+	  gapm_2[gi] = new double[2]();
+	  gapp_2[gi] = new dcomplex[2]();
+	  gappm_2[gi] = new dcomplex[2]();
+	  for (int gj=0; gj<2; gj++) {
+	    gap_2[gi][gj] =  gap[gi][gj];
+	    gapp_2[gi][gj] = gapp[gi][gj];
+	    gapm_2[gi][gj] =  gapm[gi][gj];
+	    gappm_2[gi][gj] = gappm[gi][gj];
+	  }
+	}
+	double *argi_2 = new double[1]();
+	argi_2[0] = argi[0];
+	double *args_2 = new double[1]();
+	args_2[0] = args[0];
+	double *duk_2 = new double[3]();
+	for (int di=0; di<3; di++) duk_2[di] = duk[di];
+	double **cextlr_2 = new double*[4];
+	double **cext_2 = new double*[4];
+	double **cmullr_2 = new double*[4];
+	double **cmul_2 = new double*[4];
+	for (int ci = 0; ci < 4; ci++) {
+	  cextlr_2[ci] = new double[4]();
+	  cext_2[ci] = new double[4]();
+	  cmullr_2[ci] = new double[4]();
+	  cmul_2[ci] = new double[4]();
+	  for (int cj=0; cj<4; cj++) {
+	    cextlr_2[ci][cj] = cextlr[ci][cj];
+	    cext_2[ci][cj] = cext[ci][cj];
+	    cmullr_2[ci][cj] = cmullr[ci][cj];
+	    cmul_2[ci][cj] = cmul[ci][cj];
+	  }
+	}
+	double *gapv_2 = new double[3]();
+	for (int gi=0; gi<3; gi++) gapv_2[gi] = gapv[gi];
+	double *tqev_2 = new double[3]();
+	double *tqsv_2 = new double[3]();
+	for (int ti=0; ti<3; ti++) {
+	  tqev_2[ti] = tqev[ti];
+	  tqsv_2[ti] = tqsv[ti];
+	}
+    
+	jer = cluster_jxi488_cycle(jxi488, sconf_2, gconf_2, c1_2, c1ao_2, c2_2, c3_2, c4_2, c6_2, c9_2, output, output_path, gaps_2, tqse_2, tqspe_2, tqss_2, tqsps_2, zpv_2, gapm_2, gappm_2, nth, nths, nph, nphs, nk, nks, nkks, argi_2, args_2, gap_2, gapp_2, tqce_2, tqcpe_2, tqcs_2, tqcps_2, duk_2, tppoan, cextlr_2, cext_2, cmullr_2, cmul_2, gapv_2, tqev_2, tqsv_2, nxi, nsph, mxndm, inpol, iavm, npnt, npntts, isam, lm, th, thstp, thlst, ths, thsstp, thslst, ph, phstp, phlst, phs, phsstp, phslst, th1, ph1, ths1, phs1, thsca, u, us, un, uns, up, ups, unmp, unsmp, upmp, upsmp, scan, cfmp, sfmp, cfsp, sfsp, sqsfi, exri, lcalc, arg, wn, vk, ndit, am, isq, ibf);
 
 	delete sconf_2;
 	delete gconf_2;
@@ -400,12 +457,20 @@ void cluster(string config_file, string data_file, string output_path) {
 	delete[] gaps_2;
 	for (int ti = 0; ti <2 -1; ti++) {
 	  delete[] tqse_2[ti];
+	  delete[] tqce_2[ti];
+	  delete[] tqcs_2[ti];
 	  delete[] tqspe_2[ti];
+	  delete[] tqcpe_2[ti];
+	  delete[] tqcps_2[ti];
 	  delete[] tqss_2[ti];
 	  delete[] tqsps_2[ti];
 	}
 	delete[] tqse_2;
+	delete[] tqce_2;
+	delete[] tqcs_2;
 	delete[] tqspe_2;
+	delete[] tqcpe_2;
+	delete[] tqcps_2;
 	delete[] tqss_2;
 	delete[] tqsps_2;
 	for (int zi = 0; zi < c4->lm; zi++) {
@@ -418,8 +483,34 @@ void cluster(string config_file, string data_file, string output_path) {
 	  delete[] zpv_2[zi];
 	}
 	delete[] zpv_2;
+	for (int gi = 0; gi < 3; gi++) {
+	  delete[] gap_2[gi];
+	  delete[] gapp_2[gi];
+	  delete[] gapm_2[gi];
+	  delete[] gappm_2[gi];
+	}
+	delete[] gap_2;
+	delete[] gapp_2;
+	delete[] gapm_2;
+	delete[] gappm_2;
+	delete[] argi_2;
+	delete[] args_2;
+	delete[] duk_2;
+	for (int ci = 0; ci < 4; ci++) {
+	  delete[] cextlr_2[ci];
+	  delete[] cext_2[ci];
+	  delete[] cmullr_2[ci];
+	  delete[] cmul_2[ci];
+	}
+	delete[] cextlr_2;
+	delete[] cext_2;
+	delete[] cmullr_2;
+	delete[] cmul_2;
+	delete[] gapv_2;
+	delete[] tqev_2;
+	delete[] tqsv_2;
 	
-      }// jxi488 loop
+      } // jxi488 loop
       tppoan.close();
     } else { // In case TPPOAN could not be opened. Should never happen.
       printf("\nERROR: failed to open TPPOAN file.\n");