     }
     */
 
+    func modelForIndexPath(indexPath: IndexPath) -> KonjacModel? {
+        if indexPath.row < 0 || indexPath.row >= KonjacFirebase.sharedInstance.konjacSnaps.count {
+            return nil
+        }
+
+        return KonjacFirebase.sharedInstance.konjacSnaps[indexPath.row]
+    }
+
 }
 
 extension PhrasesViewController: UITableViewDelegate {

        let storyboard = UIStoryboard(name: "RikoModalViewStoryboard", bundle: Bundle.main)
        let riko = storyboard.instantiateInitialViewController() as! RikoModalViewController

        // FIXME: use real data!
        riko.engPhrase = "asta la vista babies"
        riko.jpnPhrase = "さよならだぜベイビ"
        
        let rootViewController = UIApplication.shared.delegate?.window!?.rootViewController
        rootViewController!.modalPresentationStyle = UIModalPresentationStyle.currentContext
        present(riko, animated: true)


extension PhrasesViewController: UITableViewDataSource {
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return KonjacFirebase.sharedInstance.konjacSnaps.count
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        guard let model = self.modelForIndexPath(indexPath: indexPath) else { return UITableViewCell() }
        let cell = tableView.dequeueReusableCell(withIdentifier: "Cell") as! PhraseTableViewCell
        cell.mainPhrase.text = model.english
        cell.subPhrase.text = model.japanese
        return cell
    }
}
