     (reset! tmp-model (display-string (time-int->hour-minute (validated-time-integer time-int @min @max))))
   (when callback (callback time-int))))
 
-(defn dereffed-model
-  [model]
-  (if (satisfies? cljs.core/IDeref model)
-    @model
-    model))
-
 (defn atom-on
   [model default]
   (reagent/atom (if model
-                  (dereffed-model model)
+                  (real-value model)
                    default)))
 
 ;; --- Components ---

    on-change - function to call when model has changed - parameter will be the new value
    style - css"
  [& {:keys [model minimum maximum]}]
  (let [deref-model (dereffed-model model)
        tmp-model (atom-on (display-string (time-int->hour-minute deref-model)) "")
        min (atom-on minimum 0)
        max (atom-on maximum 2359)]

        val))))

(defn string->time-integer
  "Return a time integer from the passed string."
  [s]
  (let [matches (re-matches #"^(\d{0,2})()()$|^(\d{0,1})(:{0,1})(\d{0,2})$|^(\d{0,2})(:{0,1})(\d{0,2})$" s)
       vals (filter #(not (nil? %))(rest matches))]
