Adding comments to script and minor cleanup