Major refactoring of errors; lots of fixes; more tests; tests pass.