     var chatMessages = [ChatMessage]()
     var ref: Firebase?
     var channelRef: Firebase?
+    let formatter = NSDateFormatter()
     
     override func viewDidLoad() {
         super.viewDidLoad()
+        navigationItem.title = chat?.from != apiManager.currentUser ? chat?.from : chat?.to
         setUpTableView()
         observerKeyboard()
+        formatter.dateFormat = "hh:mm a dd-MM-YYYY"
+        
         let tap = UITapGestureRecognizer(target: self, action: Selector("handleTap:"))
         self.tableView.addGestureRecognizer(tap)
         ref = Firebase(url:Constants.FIREBASE_BASE_URL.stringByAppendingString("/chats/\(chat?.channelName ?? "")/messages"))

    }
    
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("MessageCell", forIndexPath: indexPath)
        let chatMessage = chatMessages[indexPath.row]
        cell.textLabel?.text = chatMessage.from
        cell.detailTextLabel?.text = chatMessage.message
        return cell
    }
}


                }
        }
    }
    
    
    func updateTotalAndUnreadCount() {
        self.channelRef?.runTransactionBlock({
