   while(doLoop){
     if (display.buttonsChanged()) {
       byte reply = display.getButtons();
+      // Green button
       if ((reply & 0x04) == 0x00){
           doLoop = false;
       }
     }  
   }
   display.clear();
-  display.printText("Starting new game!", 6, 1, GREEN);
-  
-  
-}
-
-/**********************************************
- *   GAME INITIALIZATION WITH THE SERVER
- **********************************************/
-
-int findPlayer(int player_id){
+  display.printText("Starting new game!", 6, 1, GREEN);  
+}
+
+void msgAndWait(String msg){
+  display.clear();
+  display.printText(msg, 6, 1, RED);
+  boolean doLoop = true;
+  while(doLoop){
+    if (display.buttonsChanged()) {
+      byte reply = display.getButtons();
+      // Green button
+      if ((reply & 0x04) == 0x00){
+          doLoop = false;
+      }
+    }  
+  }
+  display.clear(); 
+}
+
+void printMsg(String msg){
+  display.clear();
+  display.printText(msg, 6, 1, BLUE);
+}
+
+/**********************************************
+ *   COMMUNICATION WITH THE GAME SERVER
+ **********************************************/
+
+int findPlayer(){
   //TODO
-  Serial.println("finding player");
+  // rival_id = send ("REGISTER " + player_id + "\0n")
+  // returns the rival_id
   return 113;
 
+}
+
+int getMove(){
+  //TODO
+  // move = send ("GET_MOVE " + rival_id)
+  return 0;
+}
+
+void sendMove(int player_move){
+  //TODO
+  // send ("MOVE " + player_move + player_id)
+  return 0;
 }
 
 

// square status
int redStatus [] = {0,0,0,0,0,0,0,0,0};
int greenStatus [] = {0,0,0,0,0,0,0,0,0};

// conditions for victory
int winConditions [][9] = {{1,1,1,0,0,0,0,0,0},

/**********************************************
 *   GAME LOGIC
 **********************************************/
 
int checkPlayerMove(){
  int totalMoves = 0;
  int player_move = 0;
  char color;
  for(int i = 0; i < 9; i++){
    color = squares[i]->checkColor();
    if (previousGreenStatus[i] != greenStatus[i]){
      totalMoves++;
      player_move = i+1;
    }
  }
  
  if (totalMoves == 0) {
    // The player has not done any move
    player_move = 0;
  } else if (totalMoves > 1) {
    // The player has moved 2 pieces, which is an illegal move
    player_move = -1;
  }
  else if (color == 'r'){
    // The player has moved his piece into an square already used by the rival
    player_move = -2;
  }
  
  return player_move;
  
}


void updateBoardStatus(){
  for (int i=0; i < 9; i++){
    char color = squares[i]->checkColor();
    if (color == 'g'){
      squares[i]->setGreen();
      greenStatus[i] = 1;
    }
  }
}

void updateColorStatus(){
  for (int i=0; i < 9; i++){
