simplified the jinja template engine code