added anti-duplicate check