Matched devices fix

Fix matched_devices to match on all specified criteria (e.g. and) instead of any specified criteria (e.g. or).
Handle cases were one or more matching categories have not been specified.