histogramErrors refactor