Adding namespacing and refactoring functions.php.