   StatusModel
   (created? [this] (and (empty? @(:executions this))
                         (< @(:executor this) 0)))
-  (queued? [this] (query-new-executions this #(some queued? %)))
-  (executing? [this] (query-new-executions this #(some executing? %)))
-  (successful? [this] (query-last-execution this successful?))
-  (failed? [this] (query-last-execution this failed?)))
-
-(defn update-job-execution!
+  (queued? [this] (apply-to-new-executions this #(some queued? %)))
+  (executing? [this] (apply-to-new-executions this #(some executing? %)))
+  (successful? [this] (apply-to-last-execution this successful?))
+  (failed? [this] (apply-to-last-execution this failed?)))
+
+(defn- update-job-execution!
   [job-desc exec-id f & args]
   (dosync
     (as-> (:executions job-desc) execs
       (alter execs update-in [exec-id] #(apply f % args))))
   job-desc)
 
-(defn update-context!
+(defn- update-context!
   [job-desc exec-id f & args]
   (update-job-execution! job-desc exec-id #(as-> (:context %) $
                                              (apply f $ args))))

      (map->JobDescriptor)))

(defn get-job-execution
  [job-desc exec-id]
  (get @(:executions job-desc) exec-id))

(defn get-last-execution
  [job-desc]
  (get-job-execution job-desc @(:executor job-desc)))

(defn query-last-execution
  [job-desc f & [else]]
  (if-let [last-exec (get-last-execution job-desc)]
    (f last-exec)
    else))

(defn- query-new-executions
  [job-desc f]
  (let [execs @(:executions job-desc)
        start-id @(:executor job-desc)]

    [exec-id exec]))

(defn execute-job!
  "Synchronously execute the job execution with id `exec-id`. See
  [[schedule-job!]] for asynchronous job execution. "
  [job-desc exec-id]
  (letfn [(apply-job-fn [job-fn exec] (io! (job-fn (:context exec))))]
    (update-job-execution! job-desc exec-id mark-executing)
