refactoring modal_dialog