Added recursive depth first search