enhance matching logic