refactor pearson coefficient