Added logic to avoid duplicates