Improved the way DFS is instantiated