updated to use hierarchical k-means