Simplified cluster analysis code.