sample code for sergey for histogramming