Implemented DFS recursion verison