open dialog refactoring