refactored HistogramPyramids