     // MARK: - Table View
 
     override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
-        return rows == nil ? 0 : 1
+        return liveQuery?.rows == nil ? 0 : 1
     }
 
     override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
 
-        if let rows = rows {
+        if let rows = liveQuery?.rows {
             let count = rows.count
             return Int(count)
         }


    var detailViewController: ChatViewController? = nil

    private var rows: CBLQueryEnumerator?

    var database: CBLDatabase = {
        let app = UIApplication.sharedApplication().delegate as! AppDelegate

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)

        if let row = liveQuery?.rows?.rowAtIndex(UInt(indexPath.row)),
            let name = row.key as? String {
                cell.textLabel?.text = name
        }
