basic implementation of histogramm (still with some bugs)