 
                 }
                 dispatch_async(mainQueue, { handler(mappedResponse) })
-            }
+            })
             
             task.resume()
 

    case CONNECT = "CONNECT"
}

// use private, global scope variable until we can use stored class var in Swift 1.2
private var instancePairDictionary = [String: (API, NSURLSession)]()
private let instancePairSemaphore = dispatch_semaphore_create(1)

public class API: NSObject, NSURLSessionDelegate {
    // configurations
    public class func baseURL() -> NSURL {
        fatalError("API.baseURL() must be overrided in subclasses.")

        let mainQueue = dispatch_get_main_queue()
        
        if let URLRequest = request.URLRequest {
            let task = session.dataTaskWithRequest(URLRequest)
            
            task.completionHandler = Box({ data, URLResponse, connectionError in
                if let error = connectionError {
                    dispatch_async(mainQueue, { handler(.Failure(Box(error))) })
                    return
