         if(indexPath.row > 1){
             
             if(self.chatMessageData[self.lastJoinedRoom!]![indexPath.row - 1].userId == self.chatMessageData[self.lastJoinedRoom!]![indexPath.row - 2].userId){
-            
+                
                 sameUser = true
                 
             }

            
            
        }
        //If different user and joined the channel - return a full detailed cell
        else if (!sameUser && self.chatMessageData[self.lastJoinedRoom!]![indexPath.row - 1].messageType == "uj"){
            
            var fullDetailsCell:MainTableViewCell? = mainTableview.dequeueReusableCellWithIdentifier("fullDetailsCell", forIndexPath: indexPath) as? MainTableViewCell

        self.lastJoinedRoomName = NSUserDefaults.standardUserDefaults().valueForKey("lastJoinedRoomName") as? String
        self.lastJoinedRoom = NSUserDefaults.standardUserDefaults().valueForKey("lastJoinedRid") as? String
        self.title = "#\(NSUserDefaults.standardUserDefaults().valueForKey("lastJoinedRoomName")!)"
        
        
        if self.chatMessageData[lastJoinedRoom!] == nil {
            
            loadHistory(self.lastJoinedRoom!, numberOfMessages: 50)
            
        }else {
            
            self.mainTableview.reloadData()
            
            //If iOS 8 scrolling doesn't work properly.
            self.bottomIndexPath = NSIndexPath(forRow: self.chatMessageData[self.lastJoinedRoom!]!.count, inSection: 0)
            
            //Uncomment this if you want to scroll at the bottom even when selecting the current channel
            self.mainTableview.scrollToRowAtIndexPath(self.bottomIndexPath, atScrollPosition: UITableViewScrollPosition.Bottom, animated: false)
            
        }
        
    }
