remove loops using dfs...