Add unit tests. Improve coverage.