Further improvements and test coverage.