cleaned up template autogeneration