Extract a few bits out of app.py