complete autopairing implementation