Improved documentation for some private methods.
Improved documentation and added unit tests.