upgraded agglomerative clustering code. Closes #102