           [:h2 "Projects"]
           [:ul {:class "breadcrumb"}
            [:li [:a
-                 {:onClick (fn projects-div-history-change
-                             [_ _]
-                             (history/update-token-ids! history :programmes nil)
-                             (fixed-scroll-to-element "programmes-div"))}
+                 {:onClick (back-to-programmes history)}
                  (title-for programmes)]]]
           (om/build projects-table projects {:opts {:histkey :projects}})])))))
 

          [:h2  "Devices"]
          [:ul {:class "breadcrumb"}
           [:li [:a
                 {:onClick (fn [_ _]
                             (history/update-token-ids! history :properties nil)
                             (history/update-token-ids! history :projects nil)
                             (history/update-token-ids! history :programmes nil)
                             (fixed-scroll-to-element "programmes-div"))}
                 (title-for programmes)]]
           [:li [:a
                 {:onClick (fn [_ _]
                             (history/update-token-ids! history :properties nil)
                             (history/update-token-ids! history :projects nil)
                             (fixed-scroll-to-element "projects-div"))}
                 (title-for projects)]]
           [:li [:a
                 {:onClick (fn [_ _]
                             (history/update-token-ids! history :properties nil)
                             (fixed-scroll-to-element "properties-div"))}
                 (title-for properties :title-key :addressStreetTwo)]]]
          (om/build devices-table devices {:opts {:histkey :devices}})])))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(defn devices-div [tables owner]
  (reify
    om/IDidUpdate
    (did-update [_ prev-props prev-state]
      (let [{:keys [properties devices active-components]} tables
            new-property-id (:properties active-components)]

        (println "Active Components: " active-components)

        ;; handle selection perties table
        (when-not new-property-id
          (println "Clearing devices data.")
          (om/update! devices :data [])
          (om/update! devices :selected nil))
        
        (if (and new-property-id
                 (not (= (:property-id devices) new-property-id)))
          (GET (str "/4/entities/" new-property-id "/devices/")
               {:handler  (fn [x]
                            (println "Fetching devices for property: " new-property-id)
                            (om/update! devices :data x)
                            (om/update! devices :selected nil))
                ;; TODO: Add Error Handler
                ;; FIXME: This should be application/edn
                :headers {"Accept" "application/json"}
                :response-format :json
                :keywords? true})
          (println "Not fetching devices!"))
        (om/update! devices :property-id new-property-id)

        ;; handle seledevices table
        (om/update! devices :selected (:devices active-components))))
    om/IRender
    (render [_]
      (let [{:keys [programmes projects properties devices active-components]} tables
