adjust app.py to upper layer