Implemented row sampling for histograms and tweaked the valley finding algorithm