Found uncommitted changes to this script. Also added some comments.