Refactoring

minor functions.php refactoring