Fixed code so it runs.
Added methods for dfs