             (assoc! :entity-component-types (assoc entity-component-types entity (-> entity-component-types (get entity) (disj type))))
             persistent!)))
 
-#_
-(defn remove-component!
-    "Remove a component instance from an entity"
-    [entity instance]
-    (let [type (get-component-type instance)]
-        (dosync
-            (alter entity-components assoc type (dissoc (get @entity-components type) entity))
-            (alter entity-component-types assoc entity (disj (get @entity-component-types entity) type)))))
-
-#_
-(reduce (fn [v e]
-            (assoc v e (dissoc (get v e) :e)))
-        m k)
-
 (defn kill-entity
     "Destroy an entity completely."
     [system entity]

            (assoc! :entity-component-types (assoc ects entity (-> ects (get entity) (conj type))))
            persistent!)))

#_
(defn add-component!
    "Add a component instance to a given entity. Will overwrite a component if already set."
    [entity instance]
    (dosync
        (let [type (get-component-type instance)]
            (alter entity-components assoc-in [type entity] instance)
            (alter entity-component-types assoc entity (conj (get @entity-component-types entity) type)))))

(defn get-component
    "Get the component data for a specific component type"
    [system entity type]
    (-> system :entity-components (get-in [type entity])))

#_
(defn get-component
    "Get the component data for a specific component type"
    [entity type]
    (get-in @entity-components [type entity]))

(defn get-all-entities-with-component
    "Get all the entities that have a given component type"

                                                            (transient (:entity-components system)) (get entity-component-types entity))))
            persistent!)))

(defn get-all-components-on-entity
    "Get all the components on a specific entity. Useful for debugging"
    [system entity]
