refactoring dialogs