Improve documentation and code organization