adds new unit tests and fixes schema errors detected by the tests.
adds more unit tests and fixes errors discovered by the tests.