unit test and docs refactoring