simplify code for wildcard matching.