Adding pair wise matching functionality