             .forEach { $0.invoke() }
     }
 }
+
+// MARK: - CGEventFlags
+private extension CGEventFlags {
+    private func contains(flags: CGEventFlags) -> Bool {
+        return rawValue & flags.rawValue == flags.rawValue
+    }
+}

        let source = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, event!, 0)
        CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopCommonModes)
        CGEventTapEnable(event!, true)
        CFRunLoopRun()
    }

    private func sendCarbonEvent(event: EventRef) -> OSStatus {

    private func sendModifiersEvent(event: CGEvent) -> Unmanaged<CGEvent>? {
        let flags = CGEventGetFlags(event)

        let commandTapped = flags.contains(.MaskCommand)
        let shiftTapped = flags.contains(.MaskShift)
        let controlTapped = flags.contains(.MaskControl)
        let altTapped = flags.contains(.MaskAlternate)

        // Only one modifier key
        let totalHash = commandTapped.hashValue + altTapped.hashValue + shiftTapped.hashValue + controlTapped.hashValue
