Refactor matcher for namespace sniff