Almost complete rewrite. Matcher uses SimpleXML instead of DOM, everything else is much better and much more consistent.