use dedup function