added unit tests; added documentation