Comments added describing how the script works.