A first attempt

Here is a first attempt of optimizing using a bounding box.