refactor update code; this is generic to all updates, so move to `updates.js`