use switch instead of cascaded if