Added distortion function for k-means