Refectoring clustering algorithms.