bestpair logic
merged