   (hull p (bottom 10.001 p)))
 
 
-(def bottom-key-guard (->> (cube mount-width mount-height web-thickness)
-                           (translate [0 0 (+ (- (/ web-thickness 2)) -5)])))
-(def bottom-front-key-guard (->> (cube mount-width (/ mount-height 2) web-thickness)
-                                 (translate [0 (/ mount-height 4) (+ (- (/ web-thickness 2)) -5)])))
-
-(defn stand-at [diameter placement]
-  (let [bumper-radius (/ diameter 2)
-       stand-diameter (+ diameter 2)
-       stand-radius (/ stand-diameter 2)]
-    (difference (->> (sphere stand-radius)
-                     (translate [0 0 (+ (/ stand-radius -2) -4.5)])
-                      placement
-                      bottom-hull)
-                (->> (cube stand-diameter stand-diameter stand-radius)
-                     (translate [0 0 (/ stand-radius -2)])
-                      placement)
-                (->> (sphere bumper-radius)
-                     (translate [0 0 (+ (/ stand-radius -2) -4.5)])
-                      placement
-                     (bottom 1.5)))))
-
-(def outer-case
-  (union
-  ;  (let [shift #(translate [0 0 (+ (+ web-thickness) 0)] %)
-   (let [shift #(scale [1 1 1] %)
-         thumb-ridge-height 1
-         thumb-back-offset -1.28
-         thumb-left-offset 1.13
-         thumb-front-offset 0.56
-         front-offset 0.3
-         left-offset 0.2
-         right-offset -0.23
-         back-offset -0.25
-         web-post-tl border-post-tl
-         web-post-tr border-post-tr
-         web-post-br border-post-br
-         web-post-bl border-post-bl
-         half-shift-correction #(translate [0 (/ mount-height 2) 0] %)
-         half-post-br (half-shift-correction web-post-br)
-         half-post-bl (half-shift-correction web-post-bl)
-         row-connections (concat
-                          (for [column (drop-last columns)
-                                row (drop-last rows)
-                                :when (or (not= column 0)
-                                          (not= row 4))]
-                            (triangle-hulls
-                             (key-place (inc column) row web-post-tl)
-                             (key-place column row web-post-tr)
-                             (key-place (inc column) row web-post-bl)
-                             (key-place column row web-post-br)))
-                          (for [column (drop-last columns)
-                                row [(last rows)]
-                                :when (or (not= column 0)
-                                          (not= row 4))]
-                            (triangle-hulls
-                             (key-place (inc column) row web-post-tl)
-                             (key-place column row web-post-tr)
-                             (key-place (inc column) row half-post-bl)
-                             (key-place column row half-post-br))))
-         column-connections (for [column columns
-                                  row (drop-last rows)
-                                  :when (or (not= column 0)
-                                            (not= row 3))]
-                              (triangle-hulls
-                               (key-place column row web-post-bl)
-                               (key-place column row web-post-br)
-                               (key-place column (inc row) web-post-tl)
-                               (key-place column (inc row) web-post-tr)))
-         diagonal-connections (for [column (drop-last columns)
-                                    row (drop-last rows)
-                                    :when (or (not= column 0)
-                                              (not= row 3))]
-                                (triangle-hulls
-                                 (key-place column row web-post-br)
-                                 (key-place column (inc row) web-post-tr)
-                                 (key-place (inc column) row web-post-bl)
-                                 (key-place (inc column) (inc row) web-post-tl)))
-         main-keys-bottom (concat row-connections
-                                  column-connections
-                                  diagonal-connections)
-         front-wall (concat
-                     (for [x (range 4 6)]
-                      (union
-                       (bottom-hull
-                             (key-place (+ x 1) 2.2 web-post-bl)
-                             (key-place x 2.2 web-post-br))
-                       (bottom-hull
-                             (key-place x 2.2 web-post-bl)
-                             (key-place x 2.2 web-post-br)
-                        ))))
-         right-wall (concat
-                     (for [x (range 1 3)]
-                      (union
-                       (bottom-hull
-                             (key-place 5.2 x web-post-br)
-                             (key-place 5.2 x web-post-tr))
-                       (bottom-hull
-                             (key-place 5.2 x web-post-br)
-                             (key-place 5.2 (dec x) web-post-tr))
-                     )))
-         back-wall (concat
-                    (for [x (range  6)]
-                      (union
-                       (hull
-                             (key-place x -0.2 web-post-tl)
-                             (key-place x -0.2 web-post-tr))
-                       (hull
-                             (key-place x -0.2 web-post-tl)
-                             (key-place (- x 1) -0.2 web-post-tr))
-                      ))
-                    )
-         left-wall (concat
-                     (for [x (range 1 3)]
-                      (union
-                       (bottom-hull
-                             (key-place -1.0 x web-post-br)
-                             (key-place -1.0 x web-post-tr))
-                       (bottom-hull
-                             (key-place -1.0 x web-post-br)
-                             (key-place -1.0 (dec x) web-post-tr))
-                     )))
-         ]
-     (apply union
-            (concat
-             ;main-keys-bottom
-             front-wall
-             right-wall
-             back-wall
-             left-wall
-             ;thumbs
-            ;  thumb-back-wall
-            ;  thumb-left-wall
-            ;  thumb-front-wall
-            ;  thumb-inside
-             ;stands)))))
-             )))))
-
-(def border-web-post (cube post-size post-size web-thickness))
-(def border-post-adj (/ border-post-size 2))
-(def border-post-tr (translate [(- (/ mount-width 2) border-post-adj) (- (/ mount-height 2) border-post-adj) 0] border-web-post))
-(def border-post-tl (translate [(+ (/ mount-width -2) border-post-adj) (- (/ mount-height 2) border-post-adj) 0] border-web-post))
-(def border-post-bl (translate [(+ (/ mount-width -2) border-post-adj) (+ (/ mount-height -2) border-post-adj) 0] border-web-post))
-(def border-post-br (translate [(- (/ mount-width 2) border-post-adj) (+ (/ mount-height -2) border-post-adj) 0] border-web-post))
-
 (def upper-brace-multiplier -4)
-(defn wall-brace [x1 y1 dx1 dy1 post1 x2 y2 dx2 dy2 post2]
+
+(defn wall-brace [place1 dx1 dy1 post1 place2 dx2 dy2 post2]
   (union
     (hull
-      (key-place x1 y1 post1)
-      (key-place x1 y1 (scale [1 1 -3] post1))
-      (key-place x1 y1 (translate [(* dx1 5) (* dy1 5) 0] (scale [1 1 -3] post1)))
-      (key-place x2 y2 post2)
-      (key-place x2 y2 (scale [1 1 -3] post2))
-      (key-place x2 y2 (translate [(* dx2 5) (* dy2 5) 0] (scale [1 1 -3] post2)))
+      (place1 post1)
+      (place1 (scale [1 1 -3] post1))
+      (place1 (translate [(* dx1 5) (* dy1 5) 0] (scale [1 1 -3] post1)))
+      (place2 post2)
+      (place2 (scale [1 1 -3] post2))
+      (place2 (translate [(* dx2 5) (* dy2 5) 0] (scale [1 1 -3] post2)))
       )
     (bottom-hull
-      (key-place x1 y1 (translate [(* dx1 5) (* dy1 5) -15] post1))
-      (key-place x1 y1 (translate [0         0         -15] post1))
-      (key-place x1 y1 (translate [(* dx1 5) (* dy1 5) -15] post1))
-      (key-place x2 y2 (translate [0         0         -15] post2))
-      (key-place x2 y2 (translate [(* dx2 5) (* dy2 5) -15] post2))
+      (place1 (translate [(* dx1 5) (* dy1 5) -15] post1))
+      (place1 (translate [0         0         -15] post1))
+      (place1 (translate [(* dx1 5) (* dy1 5) -15] post1))
+      (place2 (translate [0         0         -15] post2))
+      (place2 (translate [(* dx2 5) (* dy2 5) -15] post2))
       )
-    ; (hull
-    ;   (translate [0 0 -199] (key-place x1 y1 (translate [0         0         -15] post1)))
-    ;   (translate [0 0 -199] (key-place x2 y2 (translate [0         0         -15] post2)))
+    ;  (hull
+    ;   (translate [0 0 -19] (key-place x1 y1 (translate [0         0         -15] post1)))
+    ;   (translate [0 0 -19] (key-place x2 y2 (translate [0         0         -15] post2)))
     ;   (key-place x1 y1 (translate [(* dx1 5) (* dy1 5) -15] post1))
     ;   (key-place x1 y1 (translate [0         0         -15] post1))
     ;   (key-place x1 y1 (translate [(* dx1 5) (* dy1 5) -15] post1))
     ;   (key-place x2 y2 (translate [0         0         -15] post2))
     ;   (key-place x2 y2 (translate [(* dx1 5) (* dy1 5) -15] post2))
-    ;   )
     ))
 
+(defn key-wall-brace [x1 y1 dx1 dy1 post1 x2 y2 dx2 dy2 post2] (wall-brace (partial key-place x1 y1) dx1 dy1 post1 (partial key-place x2 y2) dx2 dy2 post2))
+
 (def case-walls
   (union
    ; back wall
-   (for [x (range 0 6)] (wall-brace x 0 0 1 web-post-tl x       0 0 1 web-post-tr))
-   (for [x (range 1 6)] (wall-brace x 0 0 1 web-post-tl (dec x) 0 0 1 web-post-tr))
+   (for [x (range 0 6)] (key-wall-brace x 0 0 1 web-post-tl x       0 0 1 web-post-tr))
+   (for [x (range 1 6)] (key-wall-brace x 0 0 1 web-post-tl (dec x) 0 0 1 web-post-tr))
+   (key-wall-brace 0 0 0 1 web-post-tl 0 0 -1 0 web-post-tl)
+   (key-wall-brace 5 0 0 1 web-post-tr 5 0 1 0 web-post-tr)
    ; right wall
-   (for [y (range 0 3)] (wall-brace 5 y 1 0 web-post-tr 5 y       1 0 web-post-br))
-   (for [y (range 1 3)] (wall-brace 5 (dec y) 1 0 web-post-br 5 y 1 0 web-post-tr))
+   (for [y (range 0 3)] (key-wall-brace 5 y 1 0 web-post-tr 5 y       1 0 web-post-br))
+   (for [y (range 1 3)] (key-wall-brace 5 (dec y) 1 0 web-post-br 5 y 1 0 web-post-tr))
+   (key-wall-brace 5 2 0 -1 web-post-br 5 2 1 0 web-post-br)
    ; left wall
-   (for [y (range 0 3)] (wall-brace 0 y -1 0 web-post-tl 0 y       -1 0 web-post-bl))
-   (for [y (range 1 3)] (wall-brace 0 (dec y) -1 0 web-post-bl 0 y -1 0 web-post-tl))
+   (for [y (range 0 3)] (key-wall-brace 0 y -1 0 web-post-tl 0 y       -1 0 web-post-bl))
+   (for [y (range 1 3)] (key-wall-brace 0 (dec y) -1 0 web-post-bl 0 y -1 0 web-post-tl))
+   ; front wall
+  ;  (key-wall-brace 2 3 0 -1 web-post-bl 2 3 0 -1 web-post-br)
+   (key-wall-brace 3 3 0 -1 web-post-bl 3 3 0 -1 web-post-br)
+   (key-wall-brace 4 2 0 -1 web-post-bl 4 2 0 -1 web-post-br)
+   (key-wall-brace 5 2 0 -1 web-post-bl 5 2 0 -1 web-post-br)
+  ;  (key-wall-brace 2 3 0 -1 web-post-br 3 3 0 -1 web-post-bl)
+   (key-wall-brace 3 3 0 -1 web-post-br 4 2 0 -1 web-post-bl)
+   (key-wall-brace 4 2 0 -1 web-post-br 5 2 0 -1 web-post-bl)
+   ; thumb walls
+   (wall-brace thumb-mr-place  0 -1 web-post-br thumb-tr-place  0 -1 thumb-post-br)
+   (wall-brace thumb-mr-place  0 -1 web-post-br thumb-mr-place  0 -1 web-post-bl)
+   (wall-brace thumb-br-place  0 -1 web-post-br thumb-br-place  0 -1 web-post-bl)
+   (wall-brace thumb-ml-place  0  1 web-post-tr thumb-ml-place  0  1 web-post-tl)
+   (wall-brace thumb-bl-place  0  1 web-post-tr thumb-bl-place  0  1 web-post-tl)
+   (wall-brace thumb-br-place -1  0 web-post-tl thumb-br-place -1  0 web-post-bl)
+   (wall-brace thumb-bl-place -1  0 web-post-tl thumb-bl-place -1  0 web-post-bl)
+   ; thumb corners
+   (wall-brace thumb-br-place -1  0 web-post-bl thumb-br-place  0 -1 web-post-bl)
+   (wall-brace thumb-bl-place -1  0 web-post-tl thumb-bl-place  0  1 web-post-tl)
+   ; thumb tweeners
+   (wall-brace thumb-mr-place  0 -1 web-post-bl thumb-br-place  0 -1 web-post-br)
+   (wall-brace thumb-ml-place  0  1 web-post-tl thumb-bl-place  0  1 web-post-tr)
+   (wall-brace thumb-bl-place -1  0 web-post-bl thumb-br-place -1  0 web-post-tl)
+
+   (wall-brace thumb-ml-place  0  1 web-post-tr thumb-tl-place -2.5  0 thumb-post-tl)
+   (wall-brace thumb-tl-place -1  0 thumb-post-tl (partial key-place 0 2) -1  0 web-post-bl)
+  ;  (wall-brace thumb-ml-place  0  1 web-post-tr thumb-tl-place  0  1 web-post-tl)
+  ;  (wall-brace thumb-tl-place  0  1 thumb-post-tl (partial key-place 0 2)  0  1 web-post-bl)
+  ;  (wall-brace thumb-tl-place  0  1 web-post-tl thumb-tl-place  0  1 thumb-post-tl)
+  ;  (wall-brace thumb-tl-place  0  1 thumb-post-tl (partial key-place 0 2)  0  1 web-post-bl)
+  ;  (wall-brace thumb-tl-place  0  1 web-post-tl thumb-tl-place  0  1 thumb-post-tl)
+   
+   (wall-brace thumb-tr-place  0 -1 thumb-post-br (partial key-place 3 3)  0 -1 web-post-bl)
   ))
 
 (spit "repl.scad"
-      (write-scad (difference (union
+      (write-scad (union
                    key-holes
-                  ;  connectors
+                   connectors
                    thumb
                    thumb-connectors
                   ;  thumbcaps
                   ;  caps
-                  ;  front-wall
-                  ;  right-wall
                    case-walls
-                   )
-                   (translate [0 0 -599] (cube 999 999 999)))))
+                   )))
+                   


          ;; Column connections
          (for [column columns
                row (range -1 lastrow)
            ;     :when (or (.contains [2 3] column)
            ;               (not= row 2))
                          ]
            (triangle-hulls
             (key-place column row web-post-bl)
             (key-place column row web-post-br)

  (apply union
         (concat
          ;; Row connections
          (for [column (range 0 (dec ncols))
                row (range 0 lastrow)]
            (triangle-hulls
             (key-place (inc column) row web-post-tl)
             (key-place column row web-post-tr)
