added comments to explain script