First min max working for bounding box