         if manager.deviceMotionAvailable{
             manager.deviceMotionUpdateInterval = interval
             manager.startDeviceMotionUpdatesToQueue(NSOperationQueue()){
-                (data: CMDeviceMotion!, error: NSError!) in
-                
-                if let isError = error{
-                    NSLog("Error: %@", isError)
-                }
-                if values != nil{
-                    values!(attitude: data.attitude)
-                }
-                
-                self.delegate?.getAttitudeFromDeviceMotion!(data.attitude)
+                (data, error) in
+                
+                if let isError = error{
+                    NSLog("Error: %@", isError)
+                }
+                if values != nil{
+                    values!(attitude: data!.attitude)
+                }
+                
+                self.delegate?.getAttitudeFromDeviceMotion!(data!.attitude)
             }
             
         } else {

    *   Starts magnetometer updates, providing data to the given handler through the given queue.
    *   You can access the retrieved values either by a Trailing Closure or through a Delegate.
    */
    @availability(iOS, introduced=5.0)
    public func getMagnetometerValues (interval: NSTimeInterval = 0.1, values: ((x: Double, y:Double, z:Double) -> ())? ){
        
        var valX: Double!

        if manager.deviceMotionAvailable{
            manager.deviceMotionUpdateInterval = interval
            manager.startDeviceMotionUpdatesToQueue(NSOperationQueue()){
                (data, error) in
                
                if let isError = error{
                    NSLog("Error: %@", isError)
                }
                valX = data!.rotationRate.x
                valY = data!.rotationRate.y
                valZ = data!.rotationRate.z
                
                if values != nil{
                    values!(x: valX, y: valY, z: valZ)
                }
                
                let absoluteVal = sqrt(valX * valX + valY * valY + valZ * valZ)
                self.delegate?.getRotationRateFromDeviceMotion!(valX, y: valY, z: valZ)
            }
            
