Refactoring functions.php