Add global config object (DFS+MR). Refactor code.