improve resizing logic