updated cal functions in app.py