Finished the UNTESTED BFS algorithm