       let cursor = modesObject[modeIndex]
       
       var shortlist = [Int]()
+      // key is only used to identify current mode setting
       for (key, arr) in category {
           var sieve = Sieve.init()
 

}

func sleepDisplay() {
  // for legacy system
  let wrangler = strdup("IOService:/IOResources/IODisplayWrangler")
  #if compiler(<5.5)
  let flag = kIOMasterPortDefault
  #else

    }
  }

  // this is a hack to read private members in CGDisplayMode
  static func decode(from modes:[CGDisplayMode]) -> [CGDisplayModeFromJSON]? {
    do {
        // first we operate the string to make it look like JSON String
        let jsonStyleModes = try CGDisplayModeFromJSON.replaces(in: "\(modes)", replacement: self.replacement)

        // then we try to decode it as JSON
        let decoder = JSONDecoder()
        let modesObject = try decoder.decode([CGDisplayModeFromJSON].self, from: jsonStyleModes.data(using: .utf8)!)

        // preliminary integrity check
        guard modesObject.count == modes.count else { return nil }

        return modesObject
    } catch {
        // TODO: catch error and warn user properly
        print(error)
        return nil
    }
  }

  // for JSON hacking
  static private let replacement = [
    // bracket: remove CGDisplayMode and [
    #"\<CGDisplayMode\s0x([0-9a-f]+)\>\s\["#: "",
