added breadth-first search