Added some code to rupgrade