Add sync and refactor