implement arbitrary subject matching; fix sibling and adjacent matches