Splitted nontrivial condition controlling MainDialog into own function