                 alert.addAction(UIAlertAction(title: "cancel", style: UIAlertActionStyle.Default, handler: nil))
                 self.presentViewController(alert, animated: true, completion: nil)
             })
-
-        }
-        
-    }
-    
-
+            
+        }
+        
+    }
+    
+    
     
     //Update action
     @IBAction func Action(sender: UIButton) {
         //adding device name to the device object
         device = PIDevice(name: deviceName.text!)
         device.type = deviceType.text
-
-        
-        //adding device type to the device object. 
+        
+        
+        //adding device type to the device object.
         //NOTE: the type has to exist in the Presence Insights. Default types are : "Internal" and "External"
         
         //method to add encrypted data

    //initializing piAdapter object and PIdevice
    var piAdapter : PIAdapter!
    var device : PIDevice!

    
    @IBOutlet weak var deviceName: UITextField!
    @IBOutlet weak var datakey: UITextField!

    @IBOutlet weak var unencryptedDataKey: UITextField!
    @IBOutlet weak var unencryptedDataValue: UITextField!
    @IBOutlet weak var deviceType: UITextField!
    
    
    //pop up alert and display BM information
    @IBAction func bmAction(sender: UIButton) {
        alert("BM Information", messageInput: "Username: \(username) \n Password: \(passwd) \n Tenant ID: \(tenantID) \n Org ID: \(orgID)")
        
    }
    
    //UI selection for which device Type exist in the user's PI
    @IBAction func DeviceTypeAction() {
        //gets org information
