     }
 
 
-    static func canOpenType(type: String) -> Bool {
-        return !(type == FileType.PDF.rawValue || type == MimeType.PDF.rawValue) && !(type == FileType.PASS.rawValue || type == MimeType.PASS.rawValue)
+    static func canOpenMIMEType(mimeType: String) -> Bool {
+        return !(mimeType == MimeType.PASS.rawValue || mimeType == MimeType.PDF.rawValue)
     }
 
     func open() {

    static let OpenInString = NSLocalizedString("Open in…", comment: "String indicating that the file can be opened in another application on the device")
}

enum FileType : String {
    case PDF = "pdf"
    case PASS = "pkpass"
    case HTML = "html"
    case TXT = "txt"
    case DEFAULT = "default"
}

enum MimeType: String {
    case PDF = "application/pdf"
    case PASS = "application/vnd.apple.pkpass"
    case HTML = "text/html"
    case TEXT = "text/plain"
    case DEFAULT = "default"
}

protocol OpenInHelper {
    init(url: NSURL)
    init?(response: NSURLResponse)
    var openInView: OpenInView? { get }

    static func canOpenType(type: String) -> Bool
    func open()
}

struct OpenInHelperFactory {

    static func helperForURL(url: NSURL, mimeType: String? = nil) -> OpenInHelper? {
        guard let type = mimeType ?? url.pathExtension else {
            return nil
        }
        if OpenPdfInHelper.canOpenType(type) {
            return OpenPdfInHelper(url: url)
        } else if OpenPassBookHelper.canOpenType(type) {
            return OpenPassBookHelper(url: url)
        } else if ShareFileHelper.canOpenType(type) {
            return ShareFileHelper(url: url)
        }

        return nil
    }

    static func helperForResponse(response: NSURLResponse) -> OpenInHelper? {
        guard let type = response.MIMEType ?? response.URL?.pathExtension else {
            return nil
        }
        if OpenPdfInHelper.canOpenType(type) {
            return OpenPdfInHelper(response: response)
        } else if OpenPassBookHelper.canOpenType(type) {
            return OpenPassBookHelper(response: response)
        } else if ShareFileHelper.canOpenType(type) {
            return ShareFileHelper(response: response)
        }
        return nil

    lazy var openInView: OpenInView? = getOpenInView(self)()

    lazy var documentDirectory: NSURL = {
        return NSURL(string: NSTemporaryDirectory())!.URLByAppendingPathComponent("pdfs")
    }()

    private var filepath: NSURL?

    required init?(response: NSURLResponse) {
        guard let responseURL = response.URL else { return nil }
