Methods to add pairs and check for existing pairs.