   (fn [state]
     (if (:gtm state)
       (let [pos (:position (:gtm state))
-            instr-map (get-in state [:gtm :tapes 0 pos])]
+            instr-map (get-in state [:gtm :tracks 0 pos])]
         (if instr-map
           (trace 'gtm_read_all
                  (push-item (:instruction instr-map) :code state)


;; All GTM instructions are no-ops on Push states that lack a GTM. 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; gtm (genetic turing machine) utilities

      state)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Instructions for changing the skew

(define-registered ;; skew to the left
  gtm_skew_left
  ^{:stack-types [:gtm]}
  (fn [state]
    (if (:gtm state)
      (trace 'gtm_skew_left
             (update-in state [:gtm :skew] dec))
      state)))

(define-registered ;; skew to the right
  gtm_skew_right
  ^{:stack-types [:gtm]}
  (fn [state]
    (if (:gtm state)
      (trace 'gtm_skew_right
             (update-in state [:gtm :skew] inc))
      state)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Instructions for swapping genes between tracks

(define-registered ;; swap genes at current position between tracks 0 and 1
  gtm_swap_all
  ^{:stack-types [:gtm]}
  (fn [state]
    (if (:gtm state)
      (trace 'gtm_swap_all
             (let [pos (:position (:gtm state))
                   skew (:skew (:gtm state))]
               (-> state
                   (assoc-in [:gtm :tracks 0 pos]
                             (get-in state [:gtm :tracks 1 (+ pos skew)]))
                   (assoc-in [:gtm :tracks 1 (+ pos skew)]
                             (get-in state [:gtm :tracks 0 pos])))))
      state)))

(define-registered ;; swap instructions at current position between tracks 0 and 1
  gtm_swap_instruction
  ^{:stack-types [:gtm]}
  (fn [state]
    (if (:gtm state)
      (trace 'gtm_swap_instruction
             (let [pos (:position (:gtm state))
                   skew (:skew (:gtm state))]
               (-> state
                   (assoc-in [:gtm :tracks 0 pos :instruction]
                             (get-in state [:gtm :tracks 1 (+ pos skew) :instruction]))
                   (assoc-in [:gtm :tracks 1 (+ pos skew) :instruction]
                             (get-in state [:gtm :tracks 0 pos :instruction])))))
      state)))

(define-registered ;; swap silent markers at current position between tracks 0 and 1
  gtm_swap_silent
  ^{:stack-types [:gtm]}
  (fn [state]
    (if (:gtm state)
      (trace 'gtm_swap_silent
             (let [pos (:position (:gtm state))
                   skew (:skew (:gtm state))]
               (-> state
                   (assoc-in [:gtm :tracks 0 pos :silent]
                             (get-in state [:gtm :tracks 1 (+ pos skew) :silent]))
                   (assoc-in [:gtm :tracks 1 (+ pos skew) :silent]
                             (get-in state [:gtm :tracks 0 pos :silent])))))
      state)))

(define-registered ;; swap close markers at current position between tracks 0 and 1
  gtm_swap_close
  ^{:stack-types [:gtm]}
  (fn [state]
    (if (:gtm state)
      (trace 'gtm_swap_close
             (let [pos (:position (:gtm state))
                   skew (:skew (:gtm state))]
               (-> state
                   (assoc-in [:gtm :tracks 0 pos :close]
                             (get-in state [:gtm :tracks 1 (+ pos skew) :close]))
                   (assoc-in [:gtm :tracks 1 (+ pos skew) :close]
                             (get-in state [:gtm :tracks 0 pos :close])))))
      state)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Instructions for reading/writing to track 0

(define-registered ;; push boolean indicating whether blank at current position
  gtm_blank
  ^{:stack-types [:gtm :boolean]}
  (fn [state]
    (if (:gtm state)
      (trace 'gtm_blank
             (let [pos (:position (:gtm state))]
               (push-item (if (get-in state [:gtm :tracks 0 pos])
                            false
                            true)
                          :boolean 
