Move some template-related methods to <template>.