Added heuristic to determine depth of search