Added the first tests and cleaned the dfs code.