improving the heatmap function