Modified Histogram Function. Now count also in non-uniform case.