Optimize octree