code cleaning

dfs now has own arrays instead of directly writing to best path