added explanation of how script works