improve documentation and tests