Don't remove duplicates manually, use a set.