Added upgrades and fixed a bug that prevented reuse of previously-built packages.