Refactoring for exact match case
Refactoring for inexact match case