update function updateAndUpgrade