Added DFS function