Rewrite for speed.