Adds clearing of references (and script comments on changed references)