switched logic