Update switch function