         })
     }
     
-    public func imageTaskWithURL(url:NSURL, completionHandler:(UIImage?, NSURLResponse?, NSError?) -> Void) -> NSURLSessionDataTask {
-        
-        return self.dataTaskWithURL(url, completionHandler: { (data:NSData?, response:NSURLResponse?, error:NSError?) in
-            
-            if let data = data {
-                completionHandler(UIImage(data: data), response, error)
-            } else {
-                completionHandler(nil, response, error)
-            }
-        })
-    }
-    
-    public func imageTask(request:NSURLRequest, completionHandler:(UIImage?, NSURLResponse?, NSError?) -> Void) -> NSURLSessionDataTask {
-        
-        return self.dataTaskWithRequest(request, completionHandler: { (data:NSData?, response:NSURLResponse?, error:NSError?) in
-            
-            if let data = data {
-                completionHandler(UIImage(data: data), response, error)
+    public func imageTaskWithURL(url:NSURL, completionHandler:(Image?, NSURLResponse?, NSError?) -> Void) -> NSURLSessionDataTask {
+        
+        return self.dataTaskWithURL(url, completionHandler: { (data:NSData?, response:NSURLResponse?, error:NSError?) in
+            
+            if let data = data {
+                completionHandler(Image(data: data), response, error)
+            } else {
+                completionHandler(nil, response, error)
+            }
+        })
+    }
+    
+    public func imageTask(request:NSURLRequest, completionHandler:(Image?, NSURLResponse?, NSError?) -> Void) -> NSURLSessionDataTask {
+        
+        return self.dataTaskWithRequest(request, completionHandler: { (data:NSData?, response:NSURLResponse?, error:NSError?) in
+            
+            if let data = data {
+                completionHandler(Image(data: data), response, error)
             } else {
                 completionHandler(nil, response, error)
             }

        return try NSJSONSerialization.JSONObjectWithData(data, options: .AllowFragments)
    }
    
    public func awaitImage(forRequest request:NSURLRequest) throws -> UIImage {
        
        let data = try self.awaitData(forRequest:request)
        
        guard let image = UIImage(data: data) else {
            throw ImageDecoding.error
        }
        

//  Copyright © 2016 Clean Water Services. All rights reserved.
//

#if os(OSX)
    import AppKit
    public typealias Image = NSImage
#else
    import UIKit
    public typealias Image = UIImage
#endif

public extension NSURLSession {
    
