Speed up histogram related code. 3D histogram is overkill.