beginning bfs implementation