     }
 
     func subscribe(listener: Listener) -> () -> Void {
-        listeners.append(listener)
-        let index = listeners.count - 1
+        let uuid = NSUUID()
+        listeners[uuid] = listener
         var isSubscribed = true
 
         func unsubscribe() {

            }

            isSubscribed = false
            _ = listeners.removeAtIndex(index)
        }
        return unsubscribe
    }

            currentState = ns
        }

        for listener in listeners.values {
            listener()
        }

