Cleaned appfunctions.py