             imageType = kUTTypeGIF
             
         default:
-            imageType = kUTTypePNG
-            fileExtension = "png"
+            type = "png"
         }
-    } else {
-        imageType = kUTTypePNG
-        fileExtension = "png"
+        
+        fileExtension = type
     }
     
     var errorCorrection = "M"
     if let correction = userDefaults.stringForKey("e") {
-        if contains(["L", "M", "Q", "H"], correction) {
+        if contains(["L", "Q", "H"], correction) {
             errorCorrection = correction
         }
     }

    println("\t-help\t\t\t\tPrint this help message")
    exit(1)
} else {
    var fileExtension : String!
    var imageType : String!
    
    if let type = userDefaults.stringForKey("t") {
        fileExtension = type
        
        switch type {
        case "jpg", "jpeg":

        if let image = generateQRImageFromString(input, errorCorrection, size) {
            
            if let URL = NSURL(fileURLWithPath:path) {
                let destination = CGImageDestinationCreateWithURL(URL, imageType, 1, nil)
                CGImageDestinationAddImage(destination, image, nil);
                if CGImageDestinationFinalize(destination) {
                    exit(0)
