bounding box refactoring