A simple implementation of hierarchical clustering