refactor heatmap, debug output