better bounding box/transform logic