Uses for loop to remove duplicates