Several edits to source and tests.