making plotting dendrogram a separate function