Use an es6 Set to track templates.

Change-Id: I7ec659b3a5da6f44f5d2aad8729a3db60e7dd4e3