using euclidean distance, removed slow pdist