Improved documentation. Included more tests.