diff --git a/src/UNL/Search/CSEGenerator.php b/src/UNL/Search/CSEGenerator.php
index 9d8b219d7e56c40e0a872972540d08af5357ba01..8a9e85b9c6c770e0901c56aed691415bb1d772e8 100644
--- a/src/UNL/Search/CSEGenerator.php
+++ b/src/UNL/Search/CSEGenerator.php
@@ -3,18 +3,18 @@ class UNL_Search_CSEGenerator
 {
     public static function generateCSE($url)
     {
-        $xml = '
+        $xml = '<?xml version="1.0" encoding="UTF-8" ?>
 <GoogleCustomizations>
     <CustomSearchEngine>
         <Title>UNL Custom Search Engine for '. htmlentities($url, ENT_QUOTES) . '</Title>
         <Description>This custom search engine was automatically generated by the UNL Web Developer Network.</Description>
         <Context>
           <BackgroundLabels>
-            <Label name="_cse_localsite" mode="FILTER"/>
-            <Label name="_cse_exclude_localsite" mode="EXCLUDE"/>
+            <Label name="_cse_localsite" mode="FILTER" />
+            <Label name="_cse_exclude_localsite" mode="ELIMINATE" />
           </BackgroundLabels>
         </Context>
-        <LookAndFeel nonprofit="true"/>
+        <LookAndFeel nonprofit="true" />
     </CustomSearchEngine>';
         $xml .= '
     <Annotations>';
@@ -27,11 +27,11 @@ class UNL_Search_CSEGenerator
         foreach (UNL_Search_CSEGenerator::getExcludedSites($url) as $exclude) {
             $xml .= "
                 <Annotation about=\"$exclude*\">
-                  <Label name=\"_cse_exclude_localsite\"/>
+                  <Label name=\"_cse_exclude_localsite\" />
                 </Annotation>";
         }
-    $xml .= '
-       </Annotations>
+        $xml .= '
+    </Annotations>
 </GoogleCustomizations>';
         return $xml;
     }