Rule based matching engine