Bug fixes and API changes from second unit test.