added clustering logic to the heatmap visualization script.