Final fixes and more tests.