Added cluster analysis code