finished depth first search