Fix ElementTemplate initialization, improve ModelDefinition routines.