implemented heuristic functions