Moved var out of bounding boxes loop