Refactor so functions is only included by header.php