I would like to move this condition check into one private function, what do you think?