refine histogram data creation logic..