Depth first search works