Update functions.py

Simplify and specify solution, ease initial testing.