 /// Displays the user's timetable.
 class TimetableViewController: UITableViewController {
     
-    /// The items being displayed in the view controller.
-    var timetable: Timetable?
-    
     /// Updates the timetable by making a request to the student timetable service, and reloading the data in the table.
     @objc func updateTimetable() {
-        guard let accessToken = PrimaryUser.loggedIn?.authenticator.accessToken else {
+        guard let user = PrimaryUser.loggedIn else {
             self.tableView.refreshControl?.endRefreshing()
             return
         }
         
-        StudentTimetableService(accessToken: accessToken).makeRequest { result in
+        guard let accessToken = user.authenticator.accessToken else {
+            self.tableView.refreshControl?.endRefreshing()
+            return
+        }
+        
+        StudentTimetableService(accessToken: accessToken).makeRequest { [weak self, weak user] result in
             switch result {
             case .success(let timetable):
-                self.timetable = timetable
+                user?.timetable = timetable
             case .error(let error):
                 print(error)
             }
             
             DispatchQueue.main.async {
-                self.tableView.reloadData()
-                self.tableView.refreshControl?.endRefreshing()
+                self?.tableView.reloadData()
+                self?.tableView.refreshControl?.endRefreshing()
             }
         }
     }

            return super.tableView(tableView, cellForRowAt: indexPath)
        }
        
        guard let timetable = self.timetable else {
            return super.tableView(tableView, cellForRowAt: indexPath)
        }
        

    
    /// :nodoc:
    override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
        return PrimaryUser.loggedIn?.timetable?.normalItemDays[section].description
    }
    
    // MARK: - UIViewController
