replaced flash to metod -> case-when