Hist rewrite for speed