         [:span#graph-link "View Chart"]]])))
 
 (defn rest-run-code [id raw-code]
-  (let [[message url failure-index] (run-code id raw-code)]
-    (json-str {:failingTest failure-index
+  (let [{:keys [message url num-tests-passed]} (run-code id raw-code)]
+    (json-str {:failingTest num-tests-passed
                :message message
                :golfScore (html (render-golf-score))
                :golfChart (html (render-golf-chart))})))

  "Run the specified code-string against the test cases for the problem with the
specified id.

Return a vector of [message-to-display url-to-display-at num-tests-passed]."
  [id raw-code]
  (try
    (let [code (.trim raw-code)

                          "You failed the unit tests")
                        (catch Throwable t (.getMessage t)))))
          [passed [fail-msg]] (split-with nil? results)]
      (assoc (if fail-msg
               {:message fail-msg :url *url*}
               (mark-completed problem code))
        :num-tests-passed (count passed)))
    (catch Throwable t {:message (.getMessage t), :url *url*
                        :num-tests-passed 0})))

(defn static-run-code [id raw-code]
  (let [{:keys [message url num-tests-passed]}
        (binding [*url* (str *url* "#prob-desc")]
          (run-code id raw-code))]
    (session/flash-put! :failing-test num-tests-passed)
    (flash-msg message url)))

(defn render-test-cases [tests]
