Fixed bug in heatMap code (Refactor in future)