Added upgrade function