Update logic for resizing