     
     
     func fetchCurrentName() {
-        let uid = FIRAuth.auth()?.currentUser?.uid
-        FIRDatabase.database().reference().child("users").child(uid!).child("name").observe(.value, with: { (snapshot) in
+        guard let uid = FIRAuth.auth()?.currentUser?.uid else {
+            return
+        }
+        FIRDatabase.database().reference().child("users").child(uid).child("name").observe(.value, with: { (snapshot) in
             if let userN = snapshot.value as? String {
                 self.userName = userN
             }

    
    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        tableView.deselectRow(at: indexPath, animated: true)
        let uid = FIRAuth.auth()?.currentUser?.uid
        if notificationSender.className != nil {
            let alertController = UIAlertController(title: "Group Invite", message: self.notificationSender.senderName! + " would like to invite you to group "
                + self.notificationSender.groupName!, preferredStyle: .alert)
            
            let noteRef = FIRDatabase.database().reference().child("users").child(uid!).child("notifications")
            
            let okAction = UIAlertAction(title: "Accept", style: UIAlertActionStyle.default) {
                UIAlertAction in
                let groupRef = FIRDatabase.database().reference().child("groups").child(self.notificationSender.gid!).child("members")
                let userRef = FIRDatabase.database().reference().child("users").child(uid!).child("groups").child(self.notificationSender.gid!)
                
                groupRef.updateChildValues([uid! : self.userName])
                userRef.updateChildValues(["gid" : self.notificationSender.gid!])
                userRef.updateChildValues(["groupClass" : self.notificationSender.className!])
                userRef.updateChildValues(["groupName" : self.notificationSender.groupName!])


    func fetchClasses() {
        userCourses.removeAll()
        guard let uid = FIRAuth.auth()?.currentUser?.uid else {
            return
        }
        FIRDatabase.database().reference().child("users").child(uid).child("courses").observe(.childAdded, with: { (snapshot) in
            print(snapshot.value as! String)
            
            self.userCourses.append(snapshot.value as! String)
