Changed CodeGen to return Template when reading templates.