made changes from discussion on issue #82, more tests & docs