Initial version
Fix error message typo
Simplify matching code