Convert template spec to object literal

This allows for metadata to be associated with the template and a simplification of the template init logic.