Adding the upgrade APIs

Thanks to @ashangit for the PR on which this is based.