Way more changes to the sync code.