Simplify script and improve documentation.