--- a/generate-page.lisp
+++ b/generate-page.lisp
@@ -1,16 +1,18 @@
-(use-package :cl-ppcre)
+(defpackage :sbcl-page (:use :cl :xml-mixed-mode :cl-ppcre)
+            (:export :generate-pages))
+(in-package :sbcl-page)
 
 (defmacro push-end (elt list)
   `(setf ,list (nconc ,list (list ,elt))))
 
-(defparameter *pages* nil)
+(defvar *pages* nil)
 
 (defmacro define-page (keyword title name body-fun &key (index-order :middle))
   `(progn
     (setf *pages* (remove ,keyword *pages* :key #'car))
     (push-end (list ,keyword ,title ,name ',body-fun ,index-order) *pages*)))
 
-(defparameter *sidebar-links* nil)
+(defvar *sidebar-links* nil)
 
 (defmacro define-sidebar-link (title url)
   `(progn
@@ -18,63 +20,57 @@
      (push-end (list ,title ,url) *sidebar-links*)))
 
 (defparameter *root*
-  (if *load-truename*
-      (make-pathname :directory (pathname-directory *load-truename*))
-      (if (boundp '*root*)
-          (symbol-value '*root*)
-          nil)))
+  (if #.*compile-file-truename*
+      (make-pathname :directory (pathname-directory #.*compile-file-truename*))
+      (if *load-truename*
+          (make-pathname :directory (pathname-directory *load-truename*))
+          (if (boundp '*root*)
+              (symbol-value '*root*)
+              nil))))
 
 (defun page-link (key)
   (concatenate 'string (third (assoc key *pages*)) ".html"))
 
 (defun wrap-page-body-fun (title body-fun)
-  `(:|html|
-    (:|head|
-     (:|title| ,(format nil "~A - Steel Bank Common Lisp" title))
-     ((:|link| :|rel| "stylesheet" :|type| "text/css" :|href| "sbcl.css")))
-    (:|body|
-     ((:|div| :|class| "header")
-      (:|h1| "Steel Bank Common Lisp"))
-     ((:|div| :|class| "sidebar")
-      (:|ul|
-      ,@(loop for i in (remove :top *pages* :key #'fifth :test-not #'eq)
-              collect `(:|li|
-                        ((:|a| :|href| ,(page-link (car i)))
-                         ,(second i))))
-      ,@(loop for i in (remove :middle *pages* :key #'fifth :test-not #'eq)
-              collect `(:|li|
-                        ((:|a| :|href| ,(page-link (car i)))
-                         ,(second i))))
-      ,@(loop for i in *sidebar-links*
-              collect `(:|li|
-                        ((:|a| :|href| ,(second i))
-                         ,(first i))))
-      ,@(loop for i in (remove :bottom *pages* :key #'fifth :test-not #'eq)
-              collect `(:|li|
-                        ((:|a| :|href| ,(page-link (car i)))
-                         ,(second i))))
-      )
-      ((:|a| :|href| "http://sourceforge.net/" :|class| "no-highlight")
-       ((:|img| :|src| "http://sourceforge.net/sflogo.php?group_id=1373"
-          :|width| "88" :|height| "31" :|border| "0" :|alt| "SourceForge Logo")))
-      " "
-      ((:|a| :|href| "http://www.sbcl.org/" :|class| "no-highlight")
-       ((:|img| :|src| "sbclbutton.png"
-          :|width| "88" :|height| "31" :|border| "0" :|alt| "(get 'sbcl)"))))
-     ((:|div| :|class| "body-contents")
-      (:|h1| ,title)
-      ,@(funcall body-fun)))))
+  (<html>
+   (<head>
+    (<title> title " - Steel Bank Common Lisp")
+    <link rel= "stylesheet" type= "text/css" href= "sbcl.css"/>)
+   (<body>
+    (<div class= "header">
+          (<h1> "Steel Bank Common Lisp"))
+    (<div class= "sidebar">
+          (<ul>
+           (loop for i in (remove :top *pages* :key #'fifth :test-not #'eq)
+              collect (<li>
+                       (<a href=,(page-link (car i))> (second i))))
+           (loop for i in (remove :middle *pages* :key #'fifth :test-not #'eq)
+              collect (<li>
+                       (<a href=,(page-link (car i))> (second i)))) 
+           (loop for i in *sidebar-links*
+                collect (<li>
+                           (<a href=,(second i)>
+                               (first i))))
+           (loop for i in (remove :bottom *pages* :key #'fifth :test-not #'eq)
+              collect (<li>
+                       (<a href=,(page-link (car i))> (second i)))))
+          (<a href= "http://sourceforge.net" class= "no-highlight">
+              <img src= "http://sourceforge.net/sflogo.php?group_id=1373"
+              width= "88" height= "31" border= "0" alt="SourceForge Logo"/>)
+          " "
+          (<a href= "http://www.sbcl.org/" class= "no-highlight">
+              <img src= "sbclbutton.png" width= "88" height= "31" border= "0" alt= "(get 'sbcl)"/>))
+    (<div class= "body-contents">
+          (<h1> title)
+          (funcall body-fun)))))
 
 (defun generate-pages ()
   (loop for (keyword title fname body-fun) in *pages*
-        do (let ((file-name (merge-pathnames (make-pathname :type "html")
-                                             (merge-pathnames fname *root*))))
-             (with-open-file (f file-name :direction :output :if-exists :supersede)
-               (write-string "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" f)
-               (terpri f)
-               (write-string "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">" f)
-               (terpri f)
-               (write-string
-                (s-xml:print-xml-string
-                 (wrap-page-body-fun title body-fun)
-                 :pretty nil) f)))))
+     do
+       (let ((file-name (merge-pathnames (make-pathname :type "html")
+                                         (merge-pathnames fname *root*))))
+         (with-open-file (f file-name :direction :output :if-exists :supersede)
+           (format f "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">~%")
+           (let ((*xml-print-mode* :html))
+             (xml-output-to-stream
+              f (wrap-page-body-fun title body-fun)))))))