The `update` function now loops over all branches