add tests; fixes to codebase from tests; docs updates