pairing algorithm complete