DFS & refactoring