made resizing more flexible