Reorganize app.py