Improve documentation and testing