Refactor functions.php, removing query-related functions.