slight optimization for functional heatmap