Completely rewrite match(es) API test cases, minor edits elsewhere