Added clean-up routine for DFS upon exit.