Updated upgrade code to latest repo architecture