Add the upgrade logic