mostly works, needs better js alert for duplicates