added pearson chi squared distance function