Add smart resizing event handling.