Update functions.php

Add global variables to code a bit less