Minor API modifications.
Added documentation.
Added tests.