         }
         return cnt
     }
-    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
-        return numerOfRows
-    }
-    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
-        guard let cell = tableView.dequeueReusableCell(withIdentifier: "statuscell") as? StatusViewCell else {
-            return UITableViewCell()
-        }
-        let content = rowContent(indexPath: indexPath)
-        if content == .error {
-            cell.imageIcon.image = UIImage.fontAwesomeIcon(name: .exclamation, textColor: .white, size: CGSize(width: 40, height: 40))
-            if let errorMessage = response?.error.errorMessage {
-                cell.textDescription.text = errorMessage
-            } else {
-                cell.textDescription.text = "No error"
-            }
-        } else if content == .mode {
-            cell.imageIcon.image = UIImage.fontAwesomeIcon(name: .compass, textColor: .white, size: CGSize(width: 40, height: 40))
-            if let mode = response?.status.mode {
-                cell.textDescription.text = mode.localized
-            } else {
-                cell.textDescription.text = "Unknown"
-            }
-        } else if content == .duration {
-            cell.imageIcon.image = UIImage.fontAwesomeIcon(name: .clockO, textColor: .white, size: CGSize(width: 40, height: 40))
+    /**
+     Generates the content for a certain view category.
+     - returns: FontAwesome icon, the height for that icon and the description for the TableViewCell.
+     */
+    private func contentForView(_ view: StatusViewEnum) -> (FontAwesome, Int, String) {
+        switch view {
+        case .error:
+            return (.exclamation, 40, response?.error.errorMessage ?? "No error")
+        case .mode:
+            return (.compass, 40, response?.status.mode.localized ?? "Unknown")
+        case .duration:
             if let duration = response?.status.duration {
                 let (h,m,_) = duration.toHoursMinutesSeconds
-                cell.textDescription.text = "\(h) hours, \(m) minutes"
-            } else {
-                cell.textDescription.text = "Unknown"
+                return (.clockO, 40, "\(h) hours, \(m) minutes")
             }
-        } else if content == .next {
-            cell.imageIcon.image = UIImage.fontAwesomeIcon(name: .arrowRight, textColor: .white, size: CGSize(width: 40, height: 40))
+            return (.clockO, 40, "Unknown")
+        case .next:
             let df = DateFormatter()
             df.timeZone = TimeZone(abbreviation: "UTC")
             df.dateStyle = .long
             df.timeStyle = .short
             if let next = response?.timer.next {
-                cell.textDescription.text = df.string(from: next)
+                return (.arrowRight, 40, df.string(from: next))
             } else {
-                cell.textDescription.text = "Unknown"
+                return (.arrowRight, 40, "Unknown")
             }
-        } else if content == .wlan {
-            cell.imageIcon.image = UIImage.fontAwesomeIcon(name: .wifi, textColor: .white, size: CGSize(width: 35, height: 35))
-            if let wifiSignal = response?.wlan.signal {
-                cell.textDescription.text = String(wifiSignal) + " dB"
-            } else {
-                cell.textDescription.text = "Could not fetch signal strength"
-            }
+        case .wlan:
+            return (.wifi, 35, response?.wlan.signal != nil ? String(response?.wlan.signal ?? 0) + " dB" : "Unknown")
+        default:
+            return (.question, 40, "")
         }
-        return cell
     }
 }

        }
        return .unknown
    }
    private var numerOfRows: Int {
        var cnt = 0
        if let _ = response?.error.errorMessage {

//

import UIKit
import FontAwesome

private enum StatusViewEnum {
    case mode, duration, next, wlan, unknown, error
}

extension StatusViewController: UITableViewDataSource {
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return numerOfRows
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        guard let cell = tableView.dequeueReusableCell(withIdentifier: "statuscell") as? StatusViewCell else {
            return UITableViewCell()
        }
        let view = rowContent(indexPath: indexPath)
        let (fa, height, description) = contentForView(view)
        cell.imageIcon.image = UIImage.fontAwesomeIcon(name: fa, textColor: .white, size: CGSize(width: height, height: height))
        cell.textDescription.text = description
        return cell
    }
    
    /**
     Determines which content to display in which row
     */
    private func rowContent(indexPath: IndexPath) -> StatusViewEnum {
        var row = indexPath.row
        if let _ = response?.error.errorMessage {
