The DFS algorithm should work now