use switch instead of if