             return
         }
         
-        let user = session.user
-        let path1 = "users/\(user.id)/profile/following_count"
-        let path2 = "users/\(user.id)/following/\(id)"
-        let path3 = "users/\(id)/followers/\(user.id)"
-        let path4 = "users/\(id)/profile/followers_count"
-        let path5 = "users/\(user.id)/feed"
-        let path6 = "users/\(id)/feed"
+        let uid = session.user.id
+        let path1 = "user-profile/\(uid)/following_count"
+        let path2 = "user-following/\(uid)/following/\(id)"
+        let path3 = "user-follower/\(id)/followers/\(uid)"
+        let path4 = "user-profile/\(id)/follower_count"
+        let path5 = "user-feed/\(uid)/posts"
+        let path6 = "user-feed/\(id)/posts"
         
         let rootRef = FIRDatabase.database().reference()
         let followingCountRef = rootRef.child(path1)

        let feed1Ref = rootRef.child(path5)
        let feed2Ref = rootRef.child(path6)
        
        followingRef.observeSingleEvent(of: .value, with: { (data) in
            guard !data.exists() else {
                error = .failedToFollow(message: "Already followed")
                callback?(error)
                return
            }
            
            followingRef.setValue(true)
            followerRef.observeSingleEvent(of: .value, with: { (data2) in
                followerRef.setValue(true)
                followingCountRef.runTransactionBlock({ (data3) -> FIRTransactionResult in
                    if let val = data3.value as? Int , val > 0 {
                        data3.value = val + 1
                    } else {
                        data3.value = 1
                    }
                    return FIRTransactionResult.success(withValue: data3)
                    
                    }, andCompletionBlock: { (err, committed, snap) in
                        guard committed else {
                            error = .failedToFollow(message: "Failed to follow.")
                            callback?(error)
                            return
                        }
                        
                        followerCountRef.runTransactionBlock({ (data4) -> FIRTransactionResult in
                            if let val = data4.value as? Int , val > 0 {
                                data4.value = val + 1
                            } else {
                                data4.value = 1
                            }
                            return FIRTransactionResult.success(withValue: data4)
                            
                            }, andCompletionBlock: { (err, committed, snap) in
                                guard committed else {
                                    error = .failedToFollow(message: "Failed to follow.")
                                    callback?(error)
                                    return
                                }
                                
                                feed2Ref.observeSingleEvent(of: .value, with: { (data5) in
                                    if let feeds = data5.value as? [String: AnyObject] {
                                        feed1Ref.updateChildValues(feeds)
                                    }
                                    callback?(nil)
                                })
                        })
                })
            })
        })
    }

            return
        }
        
        let uid = session.user.id
        let path1 = "user-profile/\(uid)/following_count"
        let path2 = "user-following/\(uid)/following/\(id)"
        let path3 = "user-follower/\(id)/followers/\(uid)"
        let path4 = "user-profile/\(id)/follower_count"
        let path5 = "user-feed/\(uid)/posts"
        let path6 = "user-feed/\(id)/posts"
        
        let rootRef = FIRDatabase.database().reference()
        let followingCountRef = rootRef.child(path1)
