Add simple regression testing code and tests for some issues.