Move common variable assignments in templates to the template class.