ifelse and switch md