Work in progress... Rewriting upgrade framework

Not yet functional.