more methods used for DFS