Move logic to JS.
Fix duplicates in SF data.