   while (waitForMove){
     updateBoardStatus();  
     player_move = checkPlayerMove();
-    if (player_move == 0){
+    if (player_move == -1){
       // No move, wait and check again
       delay(30);
-    }else if (player_move > 0){
+    }else if (player_move > -1){
       // Legal move, continue
       waitForMove = false;
-    } else if (player_move == -1){
+    } else if (player_move == -2){
       // Player has moved 2 pieces, illegal move      
       msgAndWait("You moved two pieces! Correct you move.");      
-    } else if (player_move == -2){
+    } else if (player_move == -3){
       // Player has moved the piece into an square already used.     
       msgAndWait("You moved your piece into an already used square! Correct you move.");
     }

void loop() {
  delay(200);
  
  // ******** Player turn *******
  for (int i = 0; i < 9; i++){
    previousGreenStatus[i] = greenStatus[i];
  }

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