use if instead of switch