Functions for working with templates added