Start extracting sync functionality into library