             return nil
         }
         
-        return NSFileManager.defaultManager().enumeratorAtPath(target)?.allObjects.filter({file -> Bool in
+        let csv = NSFileManager.defaultManager().enumeratorAtPath(target)?.allObjects.filter({file -> Bool in
             println("Current file in extracted folder is \(file)")
 
             return (file as String).pathExtension == "csv"
         }).first as NSString?
+        
+        return csv != nil ? target.stringByAppendingPathComponent(csv!) : nil
     }
     
+    func stream(aStream: NSStream, handleEvent eventCode: NSStreamEvent) {
+        switch eventCode {
+        case NSStreamEvent.OpenCompleted:
+            println("Stream has opened")
+            buffer = NSMutableData()
+            break
+        case NSStreamEvent.EndEncountered:
+            println("Stream has reached end")
+            break
+        case NSStreamEvent.HasBytesAvailable:
+            println("Stream has bytes available")
+            
+            let bufferSize = 1024
+            var localBuffer = Array<UInt8>(count: bufferSize, repeatedValue: 0)
+            
+            let read = (aStream as NSInputStream).read(&localBuffer, maxLength: bufferSize)
+            println("Read \(read) bytes")
+            buffer.appendBytes(localBuffer, length: localBuffer.count)
+            
+            break
+        default:
+            println("Not handling stream event: \(eventCode)")
+            
+            
+        }
+    }
 }
 


    func applicationWillTerminate(aNotification: NSNotification) {
        // Insert code here to tear down your application
    }

    func unzipAndFindCSV(file: String) -> String? {

        
        let task = NSURLSession.sharedSession().downloadTaskWithURL(u, completionHandler: { (url, response, error) -> Void in
            println("Download is over")
            if let csv = self.unzipAndFindCSV(url.path!) {
                println("Found CSV file at \(csv)")
                
                dispatch_async(dispatch_get_main_queue(), {
                    self.importFile(csv)
                })
            }
        })
        task.resume()
        
