new resizing logic