Added docstrings
Added some unit tests and docstrings. Fixed a couple of bugs discovered via tests.
chmod 644