Replace deprecated Switch with given