diff --git a/templates/12_relationship_to_many_setops.tpl b/templates/12_relationship_to_many_setops.tpl
index 9c8f04d..5a1ca8f 100644
--- a/templates/12_relationship_to_many_setops.tpl
+++ b/templates/12_relationship_to_many_setops.tpl
@@ -4,10 +4,9 @@
 	{{- $dot := . -}}
 	{{- $table := .Table -}}
 	{{- range .Table.ToManyRelationships -}}
-		{{- $varNameSingular := .ForeignTable | singular | camelCase -}}
 		{{- $rel := txtsFromToMany $dot.Tables $table . -}}
-		{{- $localNameSingular := .Table | singular | camelCase -}}
-		{{- $foreignNameSingular := .ForeignTable | singular | camelCase}}
+		{{- $varNameSingular := .Table | singular | camelCase -}}
+		{{- $foreignVarNameSingular := .ForeignTable | singular | camelCase}}
 // Add{{$rel.Function.Name}} adds the given related objects to the existing relationships
 // of the {{$table.Name | singular}}, optionally inserting them as new records.
 // Appends related to o.R.{{$rel.Function.Name}}.
@@ -50,7 +49,7 @@ func (o *{{$rel.LocalTable.NameGo}}) Add{{$rel.Function.Name}}(exec boil.Executo
 	{{end -}}
 
 	if o.R == nil {
-		o.R = &{{$localNameSingular}}R{
+		o.R = &{{$varNameSingular}}R{
 			{{$rel.Function.Name}}: related,
 		}
 	} else {
@@ -60,7 +59,7 @@ func (o *{{$rel.LocalTable.NameGo}}) Add{{$rel.Function.Name}}(exec boil.Executo
 	{{if .ToJoinTable -}}
 	for _, rel := range related {
 		if rel.R == nil {
-			rel.R = &{{$foreignNameSingular}}R{
+			rel.R = &{{$foreignVarNameSingular}}R{
 				{{$rel.Function.ForeignName}}: {{$rel.LocalTable.NameGo}}Slice{{"{"}}o{{"}"}},
 			}
 		} else {
@@ -70,7 +69,7 @@ func (o *{{$rel.LocalTable.NameGo}}) Add{{$rel.Function.Name}}(exec boil.Executo
 	{{else -}}
 	for _, rel := range related {
 		if rel.R == nil {
-			rel.R = &{{$foreignNameSingular}}R{
+			rel.R = &{{$foreignVarNameSingular}}R{
 				{{$rel.Function.ForeignName}}: o,
 			}
 		} else {
diff --git a/templates/13_all.tpl b/templates/13_all.tpl
index e1ed9dd..f46a4db 100644
--- a/templates/13_all.tpl
+++ b/templates/13_all.tpl
@@ -1,4 +1,3 @@
-{{- $tableNameSingular := .Table.Name | singular | titleCase -}}
 {{- $tableNamePlural := .Table.Name | plural | titleCase -}}
 {{- $varNameSingular := .Table.Name | singular | camelCase -}}
 // {{$tableNamePlural}}G retrieves all records.
diff --git a/templates/14_find.tpl b/templates/14_find.tpl
index 5fb5ffb..33a84dc 100644
--- a/templates/14_find.tpl
+++ b/templates/14_find.tpl
@@ -1,5 +1,4 @@
 {{- $tableNameSingular := .Table.Name | singular | titleCase -}}
-{{- $dbName := singular .Table.Name -}}
 {{- $varNameSingular := .Table.Name | singular | camelCase -}}
 {{- $colDefs := sqlColDefinitions .Table.Columns .Table.PKey.Columns -}}
 {{- $pkNames := $colDefs.Names | stringMap .StringFuncs.camelCase -}}
diff --git a/templates/16_update.tpl b/templates/16_update.tpl
index 8b84989..5d8a082 100644
--- a/templates/16_update.tpl
+++ b/templates/16_update.tpl
@@ -1,8 +1,5 @@
 {{- $tableNameSingular := .Table.Name | singular | titleCase -}}
 {{- $varNameSingular := .Table.Name | singular | camelCase -}}
-{{- $colDefs := sqlColDefinitions .Table.Columns .Table.PKey.Columns -}}
-{{- $pkNames := $colDefs.Names | stringMap .StringFuncs.camelCase -}}
-{{- $pkArgs := joinSlices " " $pkNames $colDefs.Types | join ", " -}}
 {{- $schemaTable := .Table.Name | .SchemaTable -}}
 // UpdateG a single {{$tableNameSingular}} record. See Update for
 // whitelist behavior description.