refactoring index sync job into two parts