Cleaned up findDictionaryMatch method.