minor changes

simplify the loop and make the bounding box function const again