logic change from if to case.