baseCorrelation function cleaned up