Refactor sync server