         (println (format "Test Case  %3d | Error: %s" i (str error)))))
     (println ";;------------------------------")
     (println "Outputs of best individual on training cases:")
-    (error-function best-program :train true)
+    (error-function best :train true)
     (println ";;******************************")
     )) ;; To do validation, could have this function return an altered best individual
        ;; with total-error > 0 if it had error of zero on train but not on validation

                         (when print-outputs
                           (println (format "Correct output: %-19s | Program output: %-19s" (str out-int) printed-result)))
                         ; Record the behavior
                         (when @global-print-behavioral-diversity
                           (swap! behavior conj printed-result))
                         ; Each test case is either right or wrong
                         (if (= printed-result (str out-int))
                           0
                           1))))]
        (when @global-print-behavioral-diversity
          (swap! population-behaviors conj @behavior))
        errors))))

(defn get-smallest-train-and-test
  "Returns the train and test cases."

(defn make-smallest-error-function-from-cases
  [train-cases test-cases]
  (fn the-actual-smallest-error-function
    ([individual]
     (the-actual-smallest-error-function individual :train))
    ([individual data-cases] ;; data-cases should be :train or :test
     (the-actual-smallest-error-function individual data-cases false))
    ([individual data-cases print-outputs]
      (let [behavior (atom '())
            errors (doall
                     (for [[[input1 input2 input3 input4] out-int] (case data-cases
                                                                     :train train-cases
                                                                     :test test-cases
                                                                     [])]
                       (let [final-state (run-push (:program individual)
                                                   (->> (make-push-state)
                                                     (push-item input4 :input)
                                                     (push-item input3 :input)
