                 databaseManager.uploadImage(data: data, to: path, completion: { (error) in
                     if let error = error {
                         print("AtMe:: Error uploading picture message to Firebase. \(error.localizedDescription)")
+                        self.dismiss(animated: true)
                         return
                     }
                     
                     // Now that image has uploaded, officially send the message record to the database with storage URL
-                    print("AtMe:: Image uploaded successfully to \(path)")
+                    print("AtMe:: Uploaded image to: \(path)")
                     self.send(message: Message(
                         imageURL: path,
                         sender: UserState.currentUser.username,
                         text: nil,
                         timestamp: Date()))
+                    self.dismiss(animated: true)
                 })
                 
             } else { print("AtMe:: Error extracting image from source") }
         } else { print("AtMe:: Error extracting edited UIImage from info dictionary") }
-        
-        dismiss(animated: true)
     }
     
     

    /** Dismiss the custom keyboard (the input accessory) */
    func dismissKeyboard() {
        chatInputAccessoryView.expandingTextView.resignFirstResponder()
    }
    
    

        
        // Update data source
        messages.append(message)
        print("\t\tJust added a message")
        
        // Efficiently update by updating / inserting only the cells that need to be
        //self.tableView.beginUpdates()
