     var addRemoveFolderButton:UIBarButtonItem!
     var removeFolderButton:UIBarButtonItem!
     var addFolderButton:UIBarButtonItem!
-    
+  
+    weak var addBookmarksFolderOkAction: UIAlertAction?
+  
     var isEditingInvidivualBookmark:Bool = false
 
     init() {

    func onAddBookmarksFolderButton() {
        
        let alert = UIAlertController(title: "New Folder", message: "Enter folder name", preferredStyle: UIAlertControllerStyle.Alert)

        let okAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.Default) { (alertA: UIAlertAction!) in
            postAsyncToMain {
                self.addFolder(alertA, alertController:alert)
            }
        }
        let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil)
        
        alert.addAction(okAction)
        alert.addAction(cancelAction)

        alert.addTextFieldWithConfigurationHandler({(textField: UITextField!) in
            textField.placeholder = "<folder name>"
            textField.secureTextEntry = false
            NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(self.notificationReceived(_:)), name: UITextFieldTextDidChangeNotification, object: textField)
        })
        
        self.presentViewController(alert, animated: true) {}
    }

    func addFolder(alert: UIAlertAction!, alertController: UIAlertController) {
        if let folderName = alertController.textFields?[0].text {
            if let sqllitbk = self.profile.bookmarks as? MergedSQLiteBookmarks {
                sqllitbk.createFolder(folderName).upon { _ in
                    postAsyncToMain {
