coding #3 adding the functions of the histogram