             tableView.scrollEnabled = true
         } else {
             var pparties = [[Party]]()
-            for p in parties {
+            for p in PartiesManager.sharedInstance.parties {
                 let filteredP = p.filter({ $0.isGoing })
                 if filteredP.count > 0 {
                     pparties.append(filteredP)


    @IBAction func updateSegment(sender: UISegmentedControl) {
        reloadData()
        let userDefaults = NSUserDefaults.standardUserDefaults()
        userDefaults.setInteger(sender.selectedSegmentIndex, forKey: "selectedSegmentIndex")
        userDefaults.synchronize()

    @IBAction func refresh(sender: UIRefreshControl?) {
        PartiesManager.sharedInstance.load() { [weak self] in
            self?.reloadData()
            self?.tableView.reloadData()
            sender?.endRefreshing()
        }
    }
