better pair sampling code.