old cluster analysis script