switched code snippet