 (def tcp-request-ch (atom (chan 1000)))
 
 (defn start-tcp-request-async-loop [client]
-  (go (loop []
-        (let [{:keys [callback b-a request-uuid]} (<! @tcp-request-ch)
+  (thread (loop []
+        (let [{:keys [callback b-a request-uuid]} (<!! @tcp-request-ch)
               request-uuid (keyword request-uuid)
               stream-out-ch (:out @client)
               send-result (if stream-out-ch
-                            (>! stream-out-ch b-a)
+                            (>!! stream-out-ch b-a)
                             false)]
           ;add to pending-requests
           (swap! pending-requests assoc request-uuid callback)
           (if send-result
             ;schedule a "take" from the socket
-            (>! @tcp-responce-ch callback)
+            (do
+              (println "scheduling a take...")
+              (>!! @tcp-responce-ch callback))
             (dispatch-to-callback callback {:error ":out socket channel closed, no data sent"}))
           (recur)))))
 

        :else (throw (Exception. (str "Callback of type " (type callback) " not supported")))))

(defn start-tcp-responce-async-loop [client]
  (go (loop []
        (let [callback (<! @tcp-responce-ch)
              stream-in-ch (:in @client)]
          (if-not (nil? stream-in-ch)
            (let [responce (<! stream-in-ch)
                  responce (clojure.walk/keywordize-keys (cheshire/decode (String. (byte-array responce))))
                  request-uuid (keyword (get responce :request-uuid))
                  callback (get @pending-requests request-uuid)]

(defn init
  "Initiates a tcp socket connection to the server"
  [host port]
  (reset! pending-requests {})
  (reset! tcp-request-ch (chan 1000))
  (reset! tcp-responce-ch (chan 1000))
  (reset! client (connect-stream-to-core-async-channels
