Refactored octree finalization