Changed octree to take median of corner positions