Added tree_stateful_dfmap(), time to refactor det_depends

Going to eliminate some global variables...