Added 'word' pattern. Improved error reporting.