Support batch and period sync (refactored harish's changes)