Added code to check code versions and upgrade each time sync runs