diff --git a/melhlprfns.cc b/melhlprfns.cc
index c2026b9cf795cbc3dc4ffdfe4cafcbdfd22811eb..5f7965d200e66a30af022a8a7e764a202acf7873 100644
--- a/melhlprfns.cc
+++ b/melhlprfns.cc
@@ -211,53 +211,6 @@ namespace Melodic{
 	return out;
   }
 
-  Matrix calc_corr(const Matrix& in, const Matrix& weights, int econ)
-  {
-    Matrix Res;
-	int nrows=in.Nrows();
-	int ncols=in.Ncols();    
-    Res = zeros(nrows,nrows);
-    RowVector localweights;
-    if(weights.Storage() == 0)
-      localweights = ones(1,ncols);
-    else
-      localweights = weights;
-    if(econ>0){	
-		RowVector colmeans(ncols);
-		  for (int n=1; n<=ncols; n++) {
-	        colmeans(n)=0;
-	        for (int m=1; m<=nrows; m++) {
-	          colmeans(n)+=in(m,n);
-	        }
-	        colmeans(n)/=nrows;
-	      }
-	      int dcol = econ;
-		  Matrix suba; 
-
-	      for(int ctr=1; ctr <= in.Ncols(); ctr+=dcol){
-		    suba=in.SubMatrix(1,nrows,ctr,Min(ctr+dcol-1,ncols));
-			int scolmax = suba.Ncols();
-
-			for (int n=1; n<=scolmax; n++) {
-		        double cmean=colmeans(ctr + n - 1);
-				double locw =localweights(ctr + n - 1);
-		        for (int m=1; m<=nrows; m++) {
-		          suba(m,n)-=cmean;
-			      suba(m,n)*=	locw;
-		        }
-		    }
-		    Res += suba*suba.t() / ncols;
-	      }
-    }
-    else{
-      Res = SP2(in,localweights);
-      Res = cov_r(Res,false,econ); 
-    }
-    return Res;
-  }  //Matrix calc_corr
-
-
-
   float calc_white(const Matrix& tmpE, const RowVector& tmpD, const RowVector& PercEV,  int dim, Matrix& param, Matrix& paramS, Matrix& white, Matrix& dewhite)
   {
 
@@ -335,7 +288,7 @@ namespace Melodic{
     tmp2 = calc_white(tmpE,tmpD, tmp, dim, param, paramS, white, dewhite); 
   }  //Matrix calc_white
 
-  void calc_white(const  SymmetricMatrix& Corr, int dim, Matrix& white, Matrix& dewhite)
+  void calc_white(const SymmetricMatrix& Corr, int dim, Matrix& white, Matrix& dewhite)
   {
     Matrix RE;
     DiagonalMatrix RD;
@@ -349,9 +302,10 @@ namespace Melodic{
   void std_pca(const Matrix& Mat, const Matrix& weights, SymmetricMatrix& Corr, Matrix& evecs, RowVector& evals, int econ)
   {
     if(weights.Storage()>0)
-      Corr << calc_corr(Mat, weights, econ);
+      Corr = cov_r(Mat, weights, econ);
     else
       Corr = cov_r(Mat,false,econ);
+
     DiagonalMatrix tmpD;
     EigenValues(Corr,tmpD,evecs);
     evals = tmpD.AsRow();
diff --git a/melhlprfns.h b/melhlprfns.h
index c57d0768547cfcac142aaf39be33aec088434b89..0f06f333241ba65d133e869aa5e172dcbd6504f6 100644
--- a/melhlprfns.h
+++ b/melhlprfns.h
@@ -56,8 +56,6 @@ namespace Melodic{
 
   Matrix corrcoef(const Matrix& in1, const Matrix& in2);
   Matrix corrcoef(const Matrix& in1, const Matrix& in2, const Matrix& part);
-  Matrix calc_corr(const Matrix& in, const Matrix& weights, int econ = 20000);
-
   float calc_white(const Matrix& tmpE, const RowVector& tmpD, const RowVector& PercEV, int dim, Matrix& param, Matrix& paramS, Matrix& white, Matrix& dewhite);
   float calc_white(const Matrix& tmpE, const RowVector& tmpD, const RowVector& PercEV, int dim, Matrix& white, Matrix& dewhite);
   void calc_white(const Matrix& tmpE, const RowVector& tmpD, int dim, Matrix& param, Matrix& paramS, Matrix& white, Matrix& dewhite);