added upgrade/downgrade functionality