     let help_display_list = "List all available displays by:\n    \(binary_name) -l"
     
 
-    let argc = CommandLine.arguments.count
     if argc > 1 {
-        if CommandLine.arguments[1] == "-l" || CommandLine.arguments[1] == "--list" {
+        if argv[1] == "-l" || argv[1] == "--list" {
             listDisplays(displayIDs:onlineDisplayIDs, count:displayCount)
             return
         }
 
-        if CommandLine.arguments[1] == "-m" || CommandLine.arguments[1] == "--mode" {
+        if argv[1] == "-m" || argv[1] == "--mode" {
             if argc < 3 {
                 print("Specify a display to see its supported modes. \(help_display_list)")
                 return
             }
 
-            if let displayIndex = Int(CommandLine.arguments[2]) {
+            if let displayIndex = Int(argv[2]) {
                 if displayIndex < displayCount {
                     let _info = listModesByDisplayID(_displayID:onlineDisplayIDs[displayIndex])
-                    displayModes(_display:onlineDisplayIDs[displayIndex], index:displayIndex, _modes:_info)
+                    PrintDisplayModes(_display:onlineDisplayIDs[displayIndex], index:displayIndex, _modes:_info)
                     
                 } else {
                     print("Display index: \(displayIndex) not found. \(help_display_list)")

    return nil
}

func displayModes(_display:CGDirectDisplayID?, index:Int, _modes:[CGDisplayMode]?) -> Void {
    if let display = _display {
        if let modes = _modes {
            print("Supported Modes for Display \(index):")

            var singleDisplayMode = false

            
            if  var displayIndex = Int(argv[2]) {
                if argc < 4 {
                    if displayIndex < 10 {
                        print("Specify display width")
