 import Foundation
 
-private struct Event {
+private struct EventHolder {
     var eventHandler: EventHandler
     var contextObject: BaseObject
     var name: String
-    
-    init(name: String, handler: EventHandler, contextObject: BaseObject) {
-        self.name = name
-        self.eventHandler = handler
-        self.contextObject = contextObject
-    }
 }
 
 open class BaseObject: NSObject, EventProtocol {
-    fileprivate var events = [String: Event]()
+    fileprivate var events = [String: EventHolder]()
     fileprivate var onceEventsHashes = [String]()
 
     @discardableResult

    fileprivate func on(_ eventName: String, callback: @escaping EventCallback, contextObject: BaseObject) -> String {
        let listenId = createListenId(eventName, contextObject: contextObject)
        let eventHandler = EventHandler(callback: wrapEventCallback(listenId, callback: callback))
        
        events[listenId] = Event(name: eventName, handler: eventHandler, contextObject: contextObject)
        notificationCenter().addObserver(eventHandler, selector: #selector(EventHandler.handleEvent), name: NSNotification.Name(rawValue: eventName), object: contextObject)

        return listenId

            self.removeListenerIfOnce(listenId, callback: callback)
        }
    }

    fileprivate func removeListenerIfOnce(_ listenId: String, callback: EventCallback) {
        if let index = self.onceEventsHashes.index(of: listenId) {
            onceEventsHashes.remove(at: index)
