bfs, action lamdba functions