             self!.ref!.child("likedBy").child(postId!).observeSingleEvent(of: .value, with: { (snapshot) in
                 if snapshot.hasChild(userId!) {
                     self!.ref!.child("likedBy").child(postId!).child(userId!).removeValue()
+                    post.likesArray.remove(at: post.likesArray.index(of: userUid!)!)
+                    post.numberOfLikes = String(post.likesArray.count)
+                    cell.likesCounter.text = "\(post.numberOfLikes ?? "0") likes"
                     cell.likeButton.setImage(UIImage(named: "like_white"), for: .normal)
                 } else {
                     self!.ref!.child("likedBy").child(postId!).updateChildValues([userId! : true])
+                    post.likesArray.append(userUid!)
+                    post.numberOfLikes = String(post.likesArray.count)
+                    cell.likesCounter.text = "\(post.numberOfLikes ?? "0") likes"
                     cell.likeButton.setImage(UIImage(named: "liked_like"), for: .normal)
                 }
             })

        cell.postAuthor.text = post.createdBy
        cell.postSubtitle.text = post.subtitle
        cell.postImage.sd_setImage(with: URL(string: post.image!))
        cell.likesCounter.text = "\(post.numberOfLikes ?? "0") likes"
        
        cell.tapAction = { [weak self] (cell) in

                            for likes in snapshot.children.allObjects as! [DataSnapshot] {
                                likesArray.append(likes.key)
                            }
                            post.likesArray = likesArray
                            post.numberOfLikes = String(likesArray.count)
                            requestGroup.leave()
                        })
