rewrite of dendrogram plugin