improved high level histogram computation