Refactor sync