added old heuristic version