         let request = PGoRpcApi(subrequests: methodList, intent: intent, auth: self.auth!, api: self, delegate: delegate)
         request.request()
         methodList.removeAll()
-    }
-    
-    public func setLocation(latitude: Double, longitude: Double, altitude: Double? = 6.0) {
+        if Settings.checkChallenge {
+            checkChallengeMessage()
+        }
+    }
+    
+    public func setLocation(latitude latitude: Double, longitude: Double, altitude: Double? = 6.0, horizontalAccuracy: Double? = 3.9, floor: Double? = nil, speed: Double? = nil, course: Double? = nil) {
         Location.lat = latitude
         Location.long = longitude
         Location.alt = altitude!
+        Location.horizontalAccuracy = horizontalAccuracy!
+        Location.speed = speed
+        Location.course = course
+        Location.floor = floor
     }
     
     public func simulateAppStart() {
         getPlayer()
+    }
+    
+    public func heartBeat() {
         getHatchedEggs()
         getInventory()
         checkAwardedBadges()

        }))
    }
    
    public func getPlayer() {
        let messageBuilder = Pogoprotos.Networking.Requests.Messages.GetPlayerMessage.Builder()
        methodList.append(PGoApiMethod(id: .GetPlayer, message: try! messageBuilder.build(), parser: { data in
            return try! Pogoprotos.Networking.Responses.GetPlayerResponse.parseFromData(data)
        }))

}

public struct PGoLocation {
    public var lat:Double = 0
    public var long:Double = 0
    public var alt:Double = 6
    public var horizontalAccuracy: Double = 3.9
    public var speed: Double? = nil
    public var course: Double? = nil
    public var floor: Double? = nil
}

public struct PGoSettings {
    public var requestId: UInt64 = 0
    public var timeSinceStart:UInt64 = 0
    public var realisticStartTimeAdjustment:UInt64 = 0
    public var downloadSettingsHash: String? = nil
    public var checkChallenge: Bool = true
    public var sessionHash: NSData? = nil
    public var msSinceLastLocationFixUpdate: UInt64 = 0
    public var LocationFixes: Array<Pogoprotos.Networking.Envelopes.Signature.LocationFix.Builder> =  []
    public var versionHash: Int64 = 7363665268261373700 //0.35
    public init() {}
}

public class PGoApiRequest {
    public var Location = PGoLocation()
    private var auth: PGoAuth?
    public var methodList: [PGoApiMethod] = []
    public var Settings = PGoSettings()
    
    public init(auth: PGoAuth? = nil, usingSettings: PGoSettings? = nil) {
        if (auth != nil) {
            self.auth = auth
        }
        
        if usingSettings != nil {
            Settings = usingSettings!
        } else {
            Settings.requestId = randomUInt64(UInt64(pow(Double(2),Double(62))), max: UInt64(pow(Double(2),Double(63))))
            Settings.timeSinceStart = getTimestamp()
            Settings.realisticStartTimeAdjustment = randomUInt64(1000, max: 2000)
        }
        
        if Settings.checkChallenge {
            checkChallengeMessage()
        }
    }
    
    public func randomUInt64(min: UInt64, max: UInt64) -> UInt64 {
        return UInt64(Double(max - min) * drand48() + Double(min))
    }
    
    public func getTimestamp() -> UInt64 {
        return UInt64(NSDate().timeIntervalSince1970 * 1000.0)
    }
    
    public func getTimestampSinceStart() -> UInt64 {
        return getTimestamp() - Settings.timeSinceStart
    }
    
    public func makeRequest(intent: PGoApiIntent, delegate: PGoApiDelegate?) {
        // analogous to call in pgoapi.py
        
        if methodList.count == 0 || (Settings.checkChallenge && methodList.count == 1) {
            print("makeRequest() called without any methods in methodList.")
            return
        }
