improved test code
added documenation to internal packages