Implements with DFS