Move dfs into subpackage to fix cyclic dep