First version of DFS