Created corr function