heatmap: refactoring