Upgrade system implemented

There are probably some bugs