adjusted insert code to remove dupes