factor out the building of the pairing array