         }
     }
 
+    // MARK: UITableViewDataSource
+
     override func numberOfSectionsInTableView(tableView: UITableView!) -> Int {
         if let posts = self.posts {
+            var webViewsFinishedLoading = true
+            for post in posts {
+                if let content = post.body() {
+                    if let height = self.webViewHeightCache[post.id] {
+                        
+                    } else {
+                        webViewsFinishedLoading = false
+                    }
+                }
+            }
+            if !webViewsFinishedLoading {
+                return 0
+            }
             return posts.count
         }
         return 0
     }
 
     override func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
-        let post = self.posts![section]
+        let post = self.posts[section]
         let postPhotos = post.photos()
         if postPhotos.count == 1 {
             return 2

                for post in posts {
                    if let content = post.body() as NSString? {
                        let webView = UIWebView(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 1))
                        webView.loadHTMLString(content.htmlStringWithTumblrStyle(self.view.frame.width), baseURL: NSURL(string: ""))
        
                        self.postsWebViewCache![post.id] = webView
                    }
                    
                    println(post)
                }

                self.posts = posts

    }

    override func tableView(tableView: UITableView!, heightForRowAtIndexPath indexPath: NSIndexPath!) -> CGFloat {
        let post = posts[indexPath.section]
        if indexPath.row == self.tableView(tableView, numberOfRowsInSection: indexPath.section) - 1 {
            if let height = self.webViewHeightCache[post.id] {
                return height
            }
            return 0
        }

        let postPhotos = post.photos()
