Remove dead code
Refactor out upgrade package