using switch instead of if-else statements