More test coverage.
More consistent ID processing; added tests.