Added safe heuristic.