implemented mahalanobis distances