     private let eventEmitter : EventEmitter
     private var lastId = 1
 
+    private var actionIds : [String] = []
     private var subscriptions : [String:EventSubscription] = [:]
-    private var actionIds : [String] = []
 
     public var state : State {
         didSet {


    /// Bind an Action to a Handler
    public func bindAction<T: Action>(actionType: T.Type, handler: (T) -> ()) -> String {
        return self.dispatcher.register(actionType, handler: handler)
    }

    /// Unbind an Action
    public func unbindAction(identifier: String) {
        self.dispatcher.unregister(identifier)
    }
    
    /// Register StoreListener that listen to changes of this store

    /// Emit change to any listeners
    public func emitChange() {
        self.eventEmitter.emit(StoreChangeEvent)
    }

    /// Wait for all actions registered in a store
    public func waitFor<T: Action>(actionType: T.Type) {
        self.dispatcher.waitFor(self.actionIds, actionType: actionType)
    }

    public func unregister() {
