Flaskify 2

I've replaced the werkzeug calls with Flask calls, and added two flask extensions that make this easier. Tests pass.