Refactor sync_tags