small refactoring in main dialog