working implementation of correct function
working corr function