Uses best-first search