     
     internal func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
         
-        var arrayOfLocation = locations as NSArray
-        var location = arrayOfLocation.lastObject as CLLocation
-        var coordLatLon = location.coordinate
+        let arrayOfLocation = locations as NSArray
+        let location = arrayOfLocation.lastObject as CLLocation
+        let coordLatLon = location.coordinate
         
         latitude  = coordLatLon.latitude
         longitude = coordLatLon.longitude

            
            if(error){
                
                self.geocodingCompletionHandler!(address: nil,error: error.localizedDescription)
                
            }else{
                
                var dataAsString: NSString = NSString(data: data, encoding: NSUTF8StringEncoding)
                
                // Convert the retrieved data in to an object through JSON deserialization
                var err: NSError
                var jsonResult: NSDictionary = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: nil) as NSDictionary
                
                var status = jsonResult.valueForKey("status") as NSString
                if((status.lowercaseString as NSString).isEqualToString("ok")){
                    var address = AddressParser()
                    address.parseGoogleLocationData(jsonResult)
                    let addressDict = address.addressDictionary()
                    self.geocodingCompletionHandler!(address: addressDict,error: nil)
                    
                }else{
                    
                    self.geocodingCompletionHandler!(address: nil,error: "invalid address: \(address)")
                    
                }
                
            }
            }
            
            
        )
        
        
    }
    
    func reverseGeocodeLocationUsingGoogleWithLatLon(#latitude:Double, longitude: Double,onReverseGeocodingCompletionHandler:((address:NSDictionary?, error:String?)->Void)?){
        
        self.reverseGeocodingCompletionHandler = onReverseGeocodingCompletionHandler
        
        reverseGocodeUsingGoogle(latitude: latitude, longitude: longitude)
        
    }
    
    func reverseGeocodeLocationUsingGoogleWithCoordinates(coord:CLLocation, onReverseGeocodingCompletionHandler:((address:NSDictionary?, error:String?)->Void)?){
        
        
        reverseGeocodeLocationUsingGoogleWithLatLon(latitude: coord.coordinate.latitude, longitude: coord.coordinate.longitude, onReverseGeocodingCompletionHandler: onReverseGeocodingCompletionHandler)
        
        
        
    }
    
    
    
    
    private func reverseGocodeUsingGoogle(#latitude:Double, longitude: Double){
        
        var urlString = "http://maps.googleapis.com/maps/api/geocode/json?latlng=\(latitude),\(longitude)&sensor=true" as NSString
        
        urlString = urlString.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)
        
        
        let url:NSURL = NSURL(string:urlString)
        
        let request:NSURLRequest = NSURLRequest(URL:url)
        
        let queue:NSOperationQueue = NSOperationQueue()
        
        /*
        let url = NSURL(string:urlString)
        var session = NSURLSession.sharedSession()

        var task:NSURLSessionDataTask = session.dataTaskWithURL(url, completionHandler:apiHandler)
        task.resume()
        */
        
        NSURLConnection.sendAsynchronousRequest(request,queue:queue,completionHandler:{response,data,error in
            
            if(error){
                
                self.reverseGeocodingCompletionHandler!(address: nil,error: error.localizedDescription)
                
            }else{
                
                var dataAsString: NSString = NSString(data: data, encoding: NSUTF8StringEncoding)
                
                // Convert the retrieved data in to an object through JSON deserialization
                var err: NSError
                var jsonResult: NSDictionary = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: nil) as NSDictionary
                
                var status = jsonResult.valueForKey("status") as NSString
                if((status.lowercaseString as NSString).isEqualToString("ok")){
                    var address = AddressParser()
                    address.parseGoogleLocationData(jsonResult)
                    let addressDict = address.addressDictionary()
                    self.reverseGeocodingCompletionHandler!(address: addressDict,error: nil)
                    
                }else{
                    
                    self.reverseGeocodingCompletionHandler!(address: nil,error: "invalid latitude: \(latitude) & longitude: \(longitude)")
                    
                }
                
            }
            }
            
            
        )
        
        
    }
    
    
    
    func apiHandler(data:NSData!, response:NSURLResponse!, error:NSError!) {
        
        if(error){
            
            self.reverseGeocodingCompletionHandler!(address: nil,error: error.localizedDescription)
            
        }else{
            
            var dataAsString: NSString = NSString(data: data, encoding: NSUTF8StringEncoding)
            
            // Convert the retrieved data in to an object through JSON deserialization
            var err: NSError
            var jsonResult: NSDictionary = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: nil) as NSDictionary
            
            var status = jsonResult.valueForKey("status") as NSString
            if((status.lowercaseString as NSString).isEqualToString("ok")){
                var address = AddressParser()
                address.parseGoogleLocationData(jsonResult)
                let addressDict = address.addressDictionary()
                self.reverseGeocodingCompletionHandler!(address: addressDict,error: nil)
                
            }else{
                
                self.reverseGeocodingCompletionHandler!(address: nil,error: "invalid latitude: \(latitude) & longitude: \(longitude)")
                
            }
            
        }
    }
    
    
}



    
    func geocodeUsingGoogleAddressString(#address:NSString, onGeocodingCompletionHandler:((address:NSDictionary?, error:String?)->Void)?){
        
        self.geocodingCompletionHandler = onGeocodingCompletionHandler
        
        geoCodeUsignGoogleAddress(address)
    }
    
