Added histogram generation using slices instead of a square grid