Add some basic unit tests, update documentation.