switch function update