I changed style slightly to better fit in with the rest of the project's code, added some missing comments where needed, and added in the commented code that the unchanged bounds must be copied to both of the new bboxes if it is later refactored to work that way.