Added heuristic functions.