         }
     }
     
-    deinit {
-       // NSNotificationCenter.defaultCenter().removeObserver(self)
+    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
+        
+        if segue.destinationViewController is EventViewController
+        {
+            let destination = segue.destinationViewController as! EventViewController
+            let indexPath = tableView?.indexPathForSelectedRow!
+            
+            destination.titleText = menuOptions[(tableView?.indexPathForSelectedRow?.row)!].title
+            destination.menuOptions = DataService().eventMenuOptions((tableView?.indexPathForSelectedRow?.row)!)
+            
+            // Centralise colours
+            destination.backgroundColour = colorFor(indexPath!)
+        }
+    }
+    
+    private func colorFor(indexPath: NSIndexPath) -> UIColor {
+        if (indexPath.row + 1) % 1 == 0
+        {
+            return UIColor.burntSiennaColor()
+        }
+        if (indexPath.row + 1) % 2 == 0
+        {
+            return UIColor.hopbushColor()
+        }
+        if (indexPath.row + 1) % 3 == 0
+        {
+            return UIColor.waxFlowerColor()
+        }
+        fatalError("wrong indexPath") // should never happen
+    }
+}
+
+extension WhenViewController: UITableViewDataSource {
+    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return menuOptions.count
     }
     
     func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

        
        return cell
    }
    
    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        return 80
    }
    
    
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return menuOptions.count;
    }
    
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        
        if segue.destinationViewController.isKindOfClass(EventViewController)
        {
            let destination = segue.destinationViewController as! EventViewController
            let indexPath = tableView?.indexPathForSelectedRow!
            
            
            destination.titleText = menuOptions[(tableView?.indexPathForSelectedRow?.row)!].title
            destination.menuOptions = DataService().eventMenuOptions((tableView?.indexPathForSelectedRow?.row)!)
            
            // Centralise colours
            var backgroundColour : UIColor
            if (indexPath!.row + 1) % 1 == 0
            {
                backgroundColour = UIColor(red: 238.0/255.0, green: 121.0/255.0, blue: 101.0/255.0, alpha: 1.0)
                destination.backgroundColour = backgroundColour
            }
            if (indexPath!.row + 1) % 2 == 0
            {
                backgroundColour = UIColor(red: 192.0/255.0, green: 105.0/255.0, blue: 155.0/255.0, alpha: 1.0)
                destination.backgroundColour = backgroundColour
            }
            if (indexPath!.row + 1) % 3 == 0
            {
                backgroundColour = UIColor(red: 239.0/255.0, green: 173.0/255.0, blue: 150.0/255.0, alpha: 1.0)
                destination.backgroundColour = backgroundColour
            }
        }
    }
    
    // Notifications
    
    @objc func reload(notification: NSNotification){
        dispatch_async(dispatch_get_main_queue()) { [unowned self] in
            self.tableView?.reloadData()
        }
    }

}


import UIKit

class WhenViewController : UIViewController {
    
    @IBOutlet weak private var tableView: UITableView?
    lazy var menuOptions: [MenuOption] = {
        return DataService().whenMenuOptions()
    }()
    
    // MARK: View lifecycle
    override func viewWillAppear(animated: Bool) {
        if let selectedIndex = tableView?.indexPathForSelectedRow
        {
