some refactoring; histogram calculation and representation;
.