 
     ; Get handshake
     (let [packet-id (red-byte conn)]
-      (handle-packet conn packet-id))
+      (read-packet conn packet-id))
 
     ; Send login
     (write-packet conn :login {:version 13 :username "timmy"})
 
     ; Get login
     (let [packet-id (red-byte conn)]
-      (handle-packet conn packet-id))
-
-   )
+      (read-packet conn packet-id)))
 
 (defn conn-handler [conn]
       (println "connecting")
       (login conn)
       (while (nil? (:exit @conn))
         (let [packet-id (.readByte (:in @conn))]
-          (handle-packet conn packet-id)
+          (read-packet conn packet-id)
           ))
       (println "done"))
 


(defn write-packet [conn packet-type payload]
      (cond
        (= packet-type :keepalive) nil
        (= packet-type :handshake) (write-packet-handshake conn payload)
        (= packet-type :login) (write-packet-login conn payload)
        )

          (assoc :seed (red-long conn))
          (assoc :dimension (red-byte conn))))

(defn read-packet [conn packet-id]
      (let [packet-id (int packet-id)
            packet-type (packet-types packet-id)]
        (println "\n----->")
        (println
          (cond
            (= packet-type :keepalive) (read-packet-keepalive conn)
            (= packet-type :handshake) (read-packet-handshake conn)
            (= packet-type :login) (read-packet-login conn)
            :else (str "UNKNOWN PACKET TYPE: " packet-id)
            ))
        (println "\n\n\n")))
