Begin on heatmap generation algorithm