Whoops, refactor the Flask stuff, should test to make sure it works again...