Fixed compilation errors, added a result type to the return of dfs