Added support for modal dialogs