dialog window refactoring