Added a breadth-first search function: BFS(). Also fixed some tiny bugs.