Improved min/max resizing.