Quick, dirty flask rewrite