Heuristics cleanups, fixes,  and improvements