Refactor exception hierarchy.
Implement test pattern generation.