new sync algorithm