nit: I wonder if we should just move this logic into doSync() and kill this function?