added a unittest. minor code changes
documentation cleanup