Upgraded to Python 2.7, switched to Jinja2 templates and removed some instances of bad style.