 
 public class Instagramer {
     
-    private var _clientId : String
-    private var _accessToken : String?
-    
-    private var _endPointURL = "https://api.instagram.com/v1/"
+    // MARK: init and auth
+    
+    private var _oAuth : InstagramerOAuth
+    public var oAuth : InstagramerOAuth { return _oAuth }
     
     public init(clientId: String) {
-        _clientId = clientId
-    }
-    
-    private func accessParams() -> [String: AnyObject] {
-        if let accessToken = _accessToken {
-            return ["access_token": accessToken]
-        } else {
-            return ["client_id": _clientId]
-        }
-    }
-    
+        _oAuth = InstagramerOAuth(clientId: clientId)
+    }
+
+    public func oAuth(accessToken: String) {
+        return _oAuth.oauth(accessToken)
+    }
+
+    public func oAuth(accessTokenSaveKey: String?, forceRefleshAccessToken: Bool = false, redirectURI: String, permitted: (() -> Void), denied: (() -> Void)) -> Bool {
+        return _oAuth.oauth(accessTokenSaveKey, forceRefleshAccessToken: forceRefleshAccessToken, redirectURI: redirectURI, permitted, denied)
+    }
+    
+    public func oAuthHandle(callbackURL: NSURL?) -> Bool {
+        return _oAuth.oauthHandle(callbackURL)
+    }
+    
+    // MARK: request
+    
+    private let _endPointURL = "https://api.instagram.com/v1/"
+
     public func mediaPopuler() -> InstagramerRequest<InstagramerMedia> {
         var partialURL = "media/popular"
-        return request(partialURL, parameters: accessParams())
+        return request(partialURL, parameters: _oAuth.accessParameters)
         
     }
     


}

public class InstagramerModel: NSObject {
    
}

public class InstagramerModelCreate<T: InstagramerModel> {
    
    public class func create(json: JSON) -> [T] {
        var models = [T]()
        NSLog(json.debugDescription)
        for (index: String, subJson: JSON) in json["data"] {
//            NSLog(subJson.debugDescription)
            let type = subJson["type"].string

    ) -> InstagramerRequest<InstagramerMedia> {
        
        var partialURL = "media/search"
        var parameters = _oAuth.accessParameters
        if let valid = lat { parameters["lat"] = lat }
        if let valid = lng { parameters["lng"] = lng }
        if let valid = distance { parameters["distance"] = distance }
