added upgrade function