Implement matching logic