merge patch from ebraminio - much improved bounding box code
add some stuff from github user ebraminio
 ebraminio credit