defmatcher and addmatch impl