Added DFS and unit test.