dialog refactoring