improved documentation and tests