     func stopRide() {
         locationManager.stopUpdatingLocation()
         locationManager.stopUpdatingHeading()
+        motionManager.stopAccelerometerUpdates()
         
         currentRide?.endDate = NSDate()
         

        
        currentRide?.startDate = NSDate()
        
        locationManager.startUpdatingHeading()
        locationManager.startUpdatingLocation()
    }

        point.speed = location?.speed ?? -Double.infinity
        point.time = location?.timestamp ?? NSDate()
        
        // if the iphone is facing the Z direction pointing upwards along the Y, in portrait mode
        var accFrontal = motionManager.accelerometerData?.acceleration.z ?? -Double.infinity
        var accLateral = motionManager.accelerometerData?.acceleration.x ?? -Double.infinity
        
        point.accFrontal = accFrontal
        point.accLateral = accLateral
    }
}

