                         // TODO
 
                     }
+
+                    referenceToAllGameSlots.child("lastSlot").setValue(["value": self.slotKey])
+
                 }
         })
     }

    /*
     *
     */
    func moveToNextGameSlot () {

        self.slotIncrement = (self.slotIncrement + 1) % self.maxNumberOfSlots

        if let f:Int = Int(self.firstSlotNumber) {

            let r:Int = f + self.slotIncrement
            self.slotNumber = r

        }

    }

    /*
     *
     */
    func keepPlayer0AndWaitForPlayer1 (with playerReferences:[DatabaseReference]) {

        let databaseReference = Database.database().reference()
        let referenceGameSlot = databaseReference.child("game/slots/list").child(String(self.slotNumber))

        let player0SessionId = GameSession.makeNewSessionId()
        

    /*
     *
     */
    func moveToNextGameSlot (referenceGameSlotList:DatabaseReference) {

        let referenceGameSlot:DatabaseReference = referenceGameSlotList.childByAutoId()

        let myGameSlot = ["player0": ["name" : "_new_" as AnyObject]]

        referenceGameSlot.setValue(myGameSlot)

        self.slotKey = referenceGameSlot.key

        self.playerReferences.append(referenceGameSlot.child("player0"))
        self.playerReferences.append(referenceGameSlot.child("player1"))

    }
    
    /*
     *
     */
    func setUpRemoteGameSlot () {

        let databaseReference = Database.database().reference()

        let referenceToAllGameSlots = databaseReference.child("game/slots")
        
        let referenceGameSlotList = databaseReference.child("game/slots/list")

        referenceToAllGameSlots.observeSingleEvent(

            of: DataEventType.value,
            with: {(snapshot) in

                if let allGameSlots = snapshot.value as? [String:AnyObject] {

                    self.slotKey = GamePlay.getLastGameSlotKey(allGameSlots: allGameSlots)

                    self.gameSlot = GamePlay.getLastGameSlot(allGameSlots: allGameSlots)
                    
                    var playerReferences:[DatabaseReference] = []

                    for i in 0...1 {

                        let playerReference = referenceToAllGameSlots.child("list").child(String(self.slotKey)).child("player" + String(i))

                        playerReferences.append(playerReference)

