Greatly simplify the syncing code