Added error checking and more tests.

Error-checking and the resulting exception messages are significantly
improved. I also added many more object-oriented unit tests.
In addition, this fixes an issue where the original transition table
sequence was being evaluated repeatedly.