added mahalanobis function