Refactored dialogUtils