Simplify and fix generator templates

Change-Id: Ibbfb716275917ebc292e00e894c188eef8bfd4e8