finish DFS initial version