Updated functions.py