 
 // 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

            instancePairDictionary[className] = pair
            return pair
        }()
        
        return pair
    }

    // create session and instance of API for each subclasses
    private final class var instancePair: (API, NSURLSession) {
        let className = NSStringFromClass(self)
        
        dispatch_semaphore_wait(instancePairSemaphore, DISPATCH_TIME_FOREVER)
        let pair: (API, NSURLSession) = instancePairDictionary[className] ?? {
            let instance = self.init()
            let configuration = self.URLSessionConfiguration()
