Switch to case instead of if