Rest of the code for "removing duplicates" example