Updated dfs to give better output