changed successor function to include heuristic calculation