Updated collapseDuplicates
Oops, that was the wrong method to change.
Finished the assignment