                     (send! channel (str (dispatch (read-string data)))))))))
 
 
-(defn processed-tweets
+(defn stream-handler
   "React to incoming tweets"
   [state tweet]
   (let [articles (->> (store tweet)

      (doall (map #(put! % {:topic :new-article :data articles}) (-> @state :app :out-chans))))
    (swap! state update-in [:app :recent-tweets] (fn [old new] (vec (take 100 (into [new] old)))) tweet)))


(defn tweet-processor [state]
  (let [{{:keys [credentials track follow]} :app} @state
        [in out] (gezwitscher credentials)]
    (go
      (>! in {:topic :start-stream :follow follow :track track})
      (let [status-ch (:status-ch (<! out))]
        (go-loop [status (<! status-ch)]
          (when status
            (processed-tweets state status)
            (recur (<! status-ch))))))
    (swap! state #(assoc-in %1 [:app :g-chans] %2) [in out])
    [in out]))


(defn initialize


  (initialize server-state "opt/server-config-1.edn")

  (def stop-stream
    (let [{:keys [follow track handler credentials]} (:app @server-state)]
      (start-filter-stream follow track handler credentials)))
  (stop-stream)

  (def stop-server
    (do
