improve scripts and capture output