Refactoring for exact match case