add distinct 'optional' and 'required' wildcard matching; thanks for the report, Chris Doherty
simpler check on values courtest of Robert Gonzalez