A simple hierarchical clustering implementation