Attempted to add in some heuristics.