Improved documentation and added a couple more unit tests.