Added support for breadth first search