Updated javadocs, added unit tests.