reworking to use jinja2