Added ability to cluster heirarchial and write output