added Breadth-first search function