ActivityItem code repeats a pattern of searching through an existing array for existing
matches before pushing a new term. Was able to cut down on most of those by
extracting to a merge() function.
Also includes a bit of cleanup and commenting.