added template directory and formatted main.py to use jinja2