     public func preview(text: String!, onSuccess: ([String: AnyObject]) -> (), onError: (PreviewError) -> ()) {
         
         self.resetResult()
+        self.wasOnMainThread = NSThread.isMainThread()
         
         self.text = text
         

                
            } else {
                
                dispatch_async(dispatch_get_main_queue()) {
                    
                    completion(url)
                    
                }
                
            }
            
        }

    private let session = NSURLSession.sharedSession()
    internal var text: String!
    internal var result: [String: AnyObject] = [:]
    internal var wasOnMainThread = true
    
    // MARK: - Constructor
    public init() {
