added new methods to work with the bfs algorithm