more logic for main dialog