added BFS solution