General updates to algorithm (k-means). HAC added.