rewrite of bfs octree build