Heatmap code work

added some comments, make it more accessible