deal with templates