Added heuristic calculation