wildcard matching reimpl