             nf.minimumIntegerDigits = 3 // XXX
 
             for i in 0..<modes.count {
-                var di = displayInfo(display, modes[i])
-                println("       \(nf.stringFromNumber(di.width)!) * \(nf.stringFromNumber(di.height)!) @ \(di.frequency)Hz")
+                let di = displayInfo(display, mode:modes[i])
+                print("       \(nf.stringFromNumber(di.width)!) * \(nf.stringFromNumber(di.height)!) @ \(di.frequency)Hz")
             }
         }
     }



    // strip path and leave filename
    var binary_name = Process.arguments[0].substringFromLastOcurrenceOf("/")

    // help message
    var help_msg = "".join([
                "usage: ",
                "\(binary_name) ",
                "[-h|--help] [-l|--list] [-m|--mode displayIndex] \n",

        
    }
        
    print(help_msg)
}

func setDisplayMode(let display:CGDirectDisplayID, let mode:CGDisplayMode, let designatedWidth:UInt) -> Void {
    if CGDisplayModeIsUsableForDesktopGUI(mode) {
    
        let config = UnsafeMutablePointer<CGDisplayConfigRef>.alloc(1);
    
        let error = CGBeginDisplayConfiguration(config)
        if error == .Success {
            if nil != config {
                let option:CGConfigureOption = CGConfigureOption(rawValue:2) //XXX: permanently
                CGConfigureDisplayWithDisplayMode(config.memory, display, mode, nil)
                let afterCheck = CGCompleteDisplayConfiguration(config.memory, option)
                if afterCheck != .Success {
                    CGCancelDisplayConfiguration(config.memory)
                }
            } else {
                print("Setting display mode failed")
            }
        }
    } else {
        print("This mode is unavailable for current desktop GUI")
    }
}

// list mode by display id
func listModesByDisplayID(let _displayID:CGDirectDisplayID?) -> [CGDisplayMode]? {
    if let displayID = _displayID {
        if let modeList = CGDisplayCopyAllDisplayModes(displayID, nil) {
            var modesArray = [CGDisplayMode]()

            let count = CFArrayGetCount(modeList)
            for i in 0..<count {
                let modeRaw = CFArrayGetValueAtIndex(modeList, i)
                // https://github.com/FUKUZAWA-Tadashi/FHCCommander
                let mode = unsafeBitCast(modeRaw, CGDisplayMode.self)

                modesArray.append(mode)
            }
