Changed DFS and GBFS to recursive lookup