Reduce times of stack size check; reduce transition table size.
Revise unittests: should not expose implementation details.