more logic to handle dialog output mode