         
         return cell
     }
-
-    /*
-    // Override to support conditional editing of the table view.
+    
     override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
-        // Return NO if you do not want the specified item to be editable.
         return true
     }
-    */
-
-    /*
+    
+    
     // Override to support editing the table view.
     override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
         if editingStyle == .Delete {
             // Delete the row from the data source
+            self.purchases.removeAtIndex(indexPath.row)
             tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
+            self.presentData()
+            
+            // TODO commit the change to the server
         } else if editingStyle == .Insert {
-            // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
-        }    
+            return // unsupported
+        }
     }
-    */
-
+    
     /*
     // Override to support rearranging the table view.
     override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {

        self.refreshControl = UIRefreshControl()
        self.refreshControl!.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged)
        
        self.setBlankData()
        self.loadInitialData()
        
        // Uncomment the following line to preserve selection between presentations

        self.refreshControl!.endRefreshing()
    }
    
    func presentBlank() {
        self.totalView?.backgroundColor = UIColor(colorLiteralRed: 0, green: 0, blue: 0, alpha: 0)
        self.totalLabel?.text = ""
    }
    
    func presentData() {
        dispatch_async(dispatch_get_main_queue(), {
            self.tableView.reloadData()
            
            UIView.animateWithDuration(0.4, animations: {
                self.totalView?.backgroundColor = self.colorForTotalCost()
                self.totalLabel?.text = "Total: $\(self.costTotal())"
            })
        })

    }
    
    func colorForTotalCost() -> UIColor {
