diff --git a/books/bookvol9.pamphlet b/books/bookvol9.pamphlet
index 022a512..7f369e1 100644
--- a/books/bookvol9.pamphlet
+++ b/books/bookvol9.pamphlet
@@ -6375,8 +6375,6 @@ $\rightarrow$
 \defun{compile}{compile}
 \calls{compile}{member}
 \calls{compile}{getmode}
-\calls{compile}{qcar}
-\calls{compile}{qcdr}
 \calls{compile}{get}
 \calls{compile}{modeEqual}
 \calls{compile}{userError}
@@ -6549,8 +6547,7 @@ Code for encoding function names inside package or domain
 \end{chunk}
 
 \defun{mkRepititionAssoc}{mkRepititionAssoc}
-\calls{mkRepititionAssoc}{qcar}
-\calls{mkRepititionAssoc}{qcdr}
+\calls{mkRepititionAssoc}{mkRepfun}
 \begin{chunk}{defun mkRepititionAssoc}
 (defun |mkRepititionAssoc| (z)
  (labels (
@@ -6591,7 +6588,6 @@ Code for encoding function names inside package or domain
 \defun{encodeItem}{encodeItem}
 \calls{encodeItem}{getCaps}
 \calls{encodeItem}{identp}
-\calls{encodeItem}{qcar}
 \calls{encodeItem}{pname}
 \calls{encodeItem}{stringimage}
 \begin{chunk}{defun encodeItem}
@@ -6649,8 +6645,6 @@ constructMacro (form is [nam,[lam,vl,body]])
 \end{chunk}
 
 \defun{spadCompileOrSetq}{spadCompileOrSetq}
-\calls{spadCompileOrSetq}{qcar}
-\calls{spadCompileOrSetq}{qcdr}
 \calls{spadCompileOrSetq}{contained}
 \calls{spadCompileOrSetq}{sayBrightly}
 \calls{spadCompileOrSetq}{bright}
@@ -6757,6 +6751,18 @@ constructMacro (form is [nam,[lam,vl,body]])
 
 \end{chunk}
 
+\defun{compAndDefine}{compAndDefine}
+This function is used but never defined. 
+We define a dummy function here.
+All references to it should be removed.
+\tpdhere{This function is used but never defined. Remove it.}
+\begin{chunk}{defun compAndDefine}
+(defun compAndDefine (arg)
+ (declare (ignore arg))
+ nil)
+
+\end{chunk}
+
 \defun{putInLocalDomainReferences}{putInLocalDomainReferences}
 \calls{putInLocalDomainReferences}{NRTputInTail}
 \refsdollar{putInLocalDomainReferences}{QuickCode}
@@ -11864,7 +11870,6 @@ An angry JHD - August 15th., 1984
 \calls{compColon}{isDomainForm}
 \seebook{compColon}{member}{5}
 \calls{compColon}{addDomain}
-\calls{compColon}{isDomainForm}
 \calls{compColon}{isCategoryForm}
 \calls{compColon}{unknownTypeError}
 \calls{compColon}{compColon}
@@ -19885,7 +19890,9 @@ Since it has no side effects we define it to return nil.
 \calls{whoOwns}{shut}
 \refsdollar{whoOwns}{exposeFlag}
 \begin{chunk}{defun whoOwns}
-(defun |whoOwns| (con) nil)
+(defun |whoOwns| (con)
+ (declare (ignore con))
+ nil)
 ; (let (filename quoteChar instream value)
 ; (declare (special |$exposeFlag|))
 ;  (cond
@@ -21071,7 +21078,7 @@ A nil return implies that the argument list length does not match
            (|member| (setq next (ifcar (cdr u))) |$HTspadmacros|)
            (nequal (ifcar (ifcdr (cdr u))) |$charLbrace|))
        (|checkDocError| (list "Reversing " next " and left brace"))
-       (setq acc (cons |$charLbrace| (cons next |acc|)))
+       (setq acc (cons |$charLbrace| (cons next acc)))
        (setq u (cddr u)))
      (t
       (setq acc (cons x acc))
@@ -21123,7 +21130,7 @@ A nil return implies that the argument list length does not match
          (setq count (1- count))
          (when (eql mathSymbolsOk count) (setq mathSymbolsOk nil))
          (when (eql spadflag count) (setq spadflag nil)))
-       ((and (null |mathSymbolsOk|)
+       ((and (null mathSymbolsOk)
              (|member| x '("+" "*" "=" "==" "->")))
         (when |$checkingXmptex?|
           (|checkDocError| 
@@ -21262,7 +21269,7 @@ A nil return implies that the argument list length does not match
 \refsdollar{checkAddSpaces}{charFauxNewline}
 \begin{chunk}{defun checkAddSpaces}
 (defun |checkAddSpaces| (u)
- (let (u2 space)
+ (let (u2 space i)
  (declare (special |$charBlank| |$charFauxNewline|))
   (cond
    ((null u) nil)
@@ -23249,7 +23256,7 @@ preferred to the underlying representation -- RDJ 9/12/83
 \begin{chunk}{defun comp3}
 (defun |comp3| (form mode |$e|)
  (declare (special |$e|))
- (let (env a op ml u sig varlist tmp3 body tt xprime tmp1 mprime tmp2 eprime)
+ (let (env op ml u tt tmp1)
  (declare (special |$insideCompTypeOf|))
   (setq |$e| (|addDomain| mode |$e|))
   (setq env |$e|)
@@ -23257,11 +23264,8 @@ preferred to the underlying representation -- RDJ 9/12/83
    ((and (consp mode) (eq (qfirst mode) '|Mapping|))
      (|compWithMappingMode| form mode env))
    ((and (consp mode) (eq (qfirst mode) 'quote)
-         (progn
-          (setq tmp1 (qrest mode))
-          (and (consp tmp1) (eq (qrest tmp1) nil)
-          (progn (setq a (qfirst tmp1)) t))))
-    (when (equal form a) (list form mode |$e|)))
+         (consp (qcdr mode)) (eq (qcddr mode) nil))
+    (when (equal form (qcadr mode)) (list form mode |$e|)))
    ((stringp mode)
     (when (and (atom form)
                (or (equal mode form) (equal mode (princ-to-string form))))
@@ -23278,22 +23282,9 @@ preferred to the underlying representation -- RDJ 9/12/83
             (setq u (|applyMapping| form mode env ml)))
         u)
      ((and (consp op) (eq (qfirst op) 'kappa)
-           (progn
-            (setq tmp1 (qrest op))
-            (and (consp tmp1)
-                 (progn
-                  (setq sig (qfirst tmp1))
-                   (setq tmp2 (qrest tmp1))
-                   (and (consp tmp2)
-                        (progn
-                         (setq varlist (qfirst tmp2))
-                         (setq tmp3 (qrest tmp2))
-                         (and (consp tmp3)
-                              (eq (qrest tmp3) nil)
-                              (progn
-                                (setq body (qfirst tmp3))
-                                t))))))))
-       (|compApply| sig varlist body (cdr form) mode env))
+           (consp (qcdr op)) (consp (qcddr op))
+           (consp (qcdddr op)) (eq (qcddddr op) nil))
+       (|compApply| (qcadr op) (qcaddr op) (qcadddr op) (cdr form) mode env))
      ((eq op '|:|)  (|compColon| form mode env))
      ((eq op '|::|) (|compCoerce| form mode env))
      ((and (null (eq |$insideCompTypeOf| t))
@@ -23302,21 +23293,10 @@ preferred to the underlying representation -- RDJ 9/12/83
       (t
        (setq tt (|compExpression| form mode env))
        (cond
-        ((and (consp tt)
-              (progn
-               (setq xprime (qfirst tt))
-               (setq tmp1 (qrest tt))
-               (and (consp tmp1)
-                    (progn
-                     (setq mprime (qfirst tmp1))
-                     (setq tmp2 (qrest tmp1))
-                     (and (consp tmp2)
-                          (eq (qrest tmp2) nil)
-                          (progn
-                            (setq eprime (qfirst tmp2))
-                            t)))))
-                     (null (|member| mprime (|getDomainsInScope| eprime))))
-         (list xprime mprime (|addDomain| mprime eprime)))
+        ((and (consp tt) (consp (qcdr tt)) (consp (qcddr tt))
+              (eq (qcdddr tt) nil)
+              (null (|member| (qcadr tt) (|getDomainsInScope| (qcaddr tt)))))
+         (list (qcar tt) (qcadr tt) (|addDomain| (qcadr tt) (qcaddr tt))))
         (t tt))))))))
 
 \end{chunk}
@@ -25285,6 +25265,7 @@ The current input line.
 \getchunk{defun comp2}
 \getchunk{defun comp3}
 \getchunk{defun compAdd}
+\getchunk{defun compAndDefine}
 \getchunk{defun compApplication}
 \getchunk{defun compApply}
 \getchunk{defun compApplyModemap}
diff --git a/changelog b/changelog
index 547db29..a3ac7fd 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,5 @@
+20111204 tpd src/axiom-website/patches.html 20111204.01.tpd.patch
+20111204 tpd books/bookvol9 code cleanup
 20111203 tpd src/axiom-website/patches.html 20111203.03.tpd.patch
 20111203 tpd src/interp/i-funsel.lisp treeshake compiler
 20111203 tpd books/bookvol5 treeshake interpreter
diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html
index 5684f85..d0556fb 100644
--- a/src/axiom-website/patches.html
+++ b/src/axiom-website/patches.html
@@ -3721,5 +3721,7 @@ books/bookvol5 treeshake interpreter<br/>
 src/axiom-website/videos.html GLOBAL recolor website ECEA81<br/>
 <a href="patches/20111203.03.tpd.patch">20111203.03.tpd.patch</a>
 books/bookvol5 treeshake interpreter<br/>
+<a href="patches/20111204.01.tpd.patch">20111204.01.tpd.patch</a>
+books/bookvol9 code cleanup<br/>
  </body>
 </html>
