made updateHistogram() to consume list of data
refactoring