Rename pattern matchers to be more explicit. Add tests.