refactor syncing of index