lab 6
diff --git a/src/sample/Algorithm.scala b/src/sample/Algorithm.scala
index c7442ec..5693993 100644
--- a/src/sample/Algorithm.scala
+++ b/src/sample/Algorithm.scala
@@ -14,13 +14,11 @@
         sort(xs filter (pivot <)))
     }
 
-  def countLeftMove(xs: Array[Char]): Int =
-  {
+  def countLeftMove(xs: Array[Char]): Int = {
     xs.filter(_ == MOVED_LEFT).length
   }
 
-  def countRightMove(xs: Array[Char]): Int =
-  {
+  def countRightMove(xs: Array[Char]): Int = {
     xs.filter(_ == MOVED_RIGHT).length
   }
 }
diff --git a/src/sample/ArtRico.java b/src/sample/ArtRico.java
index 8404da2..229bd7c 100644
--- a/src/sample/ArtRico.java
+++ b/src/sample/ArtRico.java
@@ -7,13 +7,15 @@
 import javafx.stage.Stage;
 
 /**
- *
+ * main class of application
  */
 public class ArtRico extends Application
-    implements Constants, MoveConstants {
+    implements Constants {
   Pane menuRoot;
   Scene scene;
   char gameMode;
+  Button[] mainMenuButtons;
+  Button[] newGameMenuButtons;
 
   /**
    * @param primaryStage
@@ -25,12 +27,10 @@
   }
 
   /**
-   * @param primaryStage
+   * create buttons for main menu
    */
-  private void showMenu(Stage primaryStage) {
-    menuRoot = new Pane();
-    menuRoot.setPrefSize(SCENE_WIDTH, SCENE_HEIGHT);
-    Button[] mainMenuButtons = new Button[MENU_SIZE];
+  void createMainMenuButtons() {
+    mainMenuButtons = new Button[MENU_SIZE];
 
     for (int i = 0; i < MENU_SIZE; i++) {
       mainMenuButtons[i] = new Button();
@@ -47,37 +47,17 @@
     mainMenuButtons[3].setText("REPLAY");
     mainMenuButtons[4].setText("EXIT");
 
+    setMainMenuHandlers();
+  }
+
+  /**
+   * set event handlers for main menu
+   */
+  void setMainMenuHandlers() {
     mainMenuButtons[0].setOnAction(e -> {
       menuRoot.getChildren().removeAll(mainMenuButtons);
-      Button[] newGameMenuButtons = new Button[4];
-      for (int i = 0; i < NEW_GAME_MENU_SIZE; i++) {
-        newGameMenuButtons[i] = new Button();
-        newGameMenuButtons[i].setLayoutX(SCENE_WIDTH / 2 - BUTTON_WIDTH / 2);
-        newGameMenuButtons[i].setLayoutY(i * (BUTTON_HEIGHT + BUTTON_BORDER)
-            + BUTTON_BORDER);
-        newGameMenuButtons[i].setPrefSize(BUTTON_WIDTH, BUTTON_HEIGHT);
-        menuRoot.getChildren().add(newGameMenuButtons[i]);
-      }
-      newGameMenuButtons[0].setText("Easy");
-      newGameMenuButtons[1].setText("Medium");
-      newGameMenuButtons[2].setText("Hard");
-      newGameMenuButtons[3].setText("Back");
-      newGameMenuButtons[0].setOnAction(event -> {
-        gameMode = EASY_MODE;
-        startGame(gameMode);
-      });
-      newGameMenuButtons[1].setOnAction(event -> {
-        gameMode = MEDIUM_MODE;
-        startGame(gameMode);
-      });
-      newGameMenuButtons[2].setOnAction(event -> {
-        gameMode = HARD_MODE;
-        startGame(gameMode);
-      });
-      newGameMenuButtons[3].setOnAction(event -> {
-        menuRoot.getChildren().removeAll(newGameMenuButtons);
-        menuRoot.getChildren().addAll(mainMenuButtons);
-      });
+      createNewGameMenuButtons();
+
     });
 
     mainMenuButtons[2].setOnAction(event -> {
@@ -92,7 +72,59 @@
     mainMenuButtons[4].setOnAction(event -> {
       System.exit(0);
     });
+  }
 
+  /**
+   * create buttons for new game menu
+   */
+  void createNewGameMenuButtons() {
+    newGameMenuButtons = new Button[4];
+    for (int i = 0; i < NEW_GAME_MENU_SIZE; i++) {
+      newGameMenuButtons[i] = new Button();
+      newGameMenuButtons[i].setLayoutX(SCENE_WIDTH / 2 - BUTTON_WIDTH / 2);
+      newGameMenuButtons[i].setLayoutY(i * (BUTTON_HEIGHT + BUTTON_BORDER)
+          + BUTTON_BORDER);
+      newGameMenuButtons[i].setPrefSize(BUTTON_WIDTH, BUTTON_HEIGHT);
+      menuRoot.getChildren().add(newGameMenuButtons[i]);
+    }
+    newGameMenuButtons[0].setText("Easy");
+    newGameMenuButtons[1].setText("Medium");
+    newGameMenuButtons[2].setText("Hard");
+    newGameMenuButtons[3].setText("Back");
+    setNewGameMenuHandlers();
+  }
+
+  /**
+   * set event handlers for new game menu
+   */
+  void setNewGameMenuHandlers() {
+    newGameMenuButtons[0].setOnAction(event -> {
+      gameMode = EASY_MODE;
+      startGame(gameMode);
+    });
+    newGameMenuButtons[1].setOnAction(event -> {
+      gameMode = MEDIUM_MODE;
+      startGame(gameMode);
+    });
+    newGameMenuButtons[2].setOnAction(event -> {
+      gameMode = HARD_MODE;
+      startGame(gameMode);
+    });
+    newGameMenuButtons[3].setOnAction(event -> {
+      menuRoot.getChildren().removeAll(newGameMenuButtons);
+      menuRoot.getChildren().addAll(mainMenuButtons);
+    });
+  }
+
+  /**
+   * show menu
+   *
+   * @param primaryStage
+   */
+  private void showMenu(Stage primaryStage) {
+    menuRoot = new Pane();
+    menuRoot.setPrefSize(SCENE_WIDTH, SCENE_HEIGHT);
+    createMainMenuButtons();
     scene = new Scene(menuRoot);
     scene.getStylesheets().add(ArtRico.class.getResource("style.css")
         .toExternalForm());
@@ -100,6 +132,11 @@
     primaryStage.show();
   }
 
+  /**
+   * start new game in another window
+   *
+   * @param gameMode
+   */
   private void startGame(char gameMode) {
     new Game(gameMode);
   }
diff --git a/src/sample/Ball.java b/src/sample/Ball.java
index b04407e..0aa955b 100644
--- a/src/sample/Ball.java
+++ b/src/sample/Ball.java
@@ -9,7 +9,7 @@
 import java.util.Set;
 
 /**
- *
+ * ball can fly and destroy bricks
  */
 public class Ball extends SimpleObject {
   Player player;
@@ -63,26 +63,26 @@
     kx = 0;
   }
 
-  void checkLeftWallCollision(){
+  void checkLeftWallCollision() {
     if (this.getTranslateX() + speed * kx <= leftBorder) {
       leftCollision = true;
     }
   }
 
-  void checkRightWallCollision(){
+  void checkRightWallCollision() {
     if (this.getTranslateX() + this.getWidth() + speed * kx
         >= rightBorder) {
       rightCollision = true;
     }
   }
 
-  void checkTopCollision(){
+  void checkTopCollision() {
     if (this.getTranslateY() + speed * ky <= topBorder) {
       topCollision = true;
     }
   }
 
-  void checkBottomCollision(){
+  void checkBottomCollision() {
     if (this.getTranslateY() + this.getHeight() + speed * ky
         >= bottomBorder) {
 
@@ -90,7 +90,7 @@
     }
   }
 
-  void checkPlayerCollisionLeft(){
+  void checkPlayerCollisionLeft() {
     if (ky > 0) {
       if (this.getTranslateX() + this.getWidth()
           > player.getTranslateX() &&
@@ -105,7 +105,7 @@
     }
   }
 
-  void checkPlayerCollisionRight(){
+  void checkPlayerCollisionRight() {
     if (kx > 0) {
       if (this.getTranslateY() + this.getHeight()
           > player.getTranslateY() &&
@@ -120,7 +120,7 @@
     }
   }
 
-  void checkPlayerCollisionTop(){
+  void checkPlayerCollisionTop() {
     if (kx < 0) {
       if (this.getTranslateY() + this.getHeight()
           > player.getTranslateY() &&
@@ -137,13 +137,13 @@
     }
   }
 
-  void checkPlayerCollision(){
+  void checkPlayerCollision() {
     checkPlayerCollisionLeft();
     checkPlayerCollisionRight();
     checkPlayerCollisionTop();
   }
 
-  void checkBrickCollisionBottom(){
+  void checkBrickCollisionBottom() {
     for (int i = 0; i < bricks.size(); i++) {
       SimpleObject brick = bricks.get(i);
       if (this.getTranslateX() + this.getWidth()
@@ -164,7 +164,7 @@
     }
   }
 
-  void checkBrickCollisionTop(){
+  void checkBrickCollisionTop() {
     for (int i = 0; i < bricks.size(); i++) {
       SimpleObject brick = bricks.get(i);
       if (this.getTranslateX() + this.getWidth()
@@ -187,7 +187,7 @@
     }
   }
 
-  void checkBrickCollisionRight(){
+  void checkBrickCollisionRight() {
     if (kx < 0) {
       for (int i = 0; i < bricks.size(); i++) {
         SimpleObject brick = bricks.get(i);
@@ -208,7 +208,7 @@
     }
   }
 
-  void checkBrickCollisionLeft(){
+  void checkBrickCollisionLeft() {
     if (kx > 0) {
       for (int i = 0; i < bricks.size(); i++) {
         SimpleObject brick = bricks.get(i);
@@ -227,7 +227,7 @@
     }
   }
 
-  void checkBrickCollision(){
+  void checkBrickCollision() {
     checkBrickCollisionBottom();
     checkBrickCollisionTop();
     checkBrickCollisionLeft();
@@ -246,7 +246,7 @@
     checkBrickCollision();
   }
 
-  void destroyBricks(){
+  void destroyBricks() {
     Set ixs = new HashSet(indexs);
     indexs.clear();
     indexs.addAll(ixs);
@@ -260,13 +260,13 @@
     }
   }
 
-  void moveBall(){
+  void moveBall() {
     setTranslateX(getTranslateX() + speed * kx);
     setTranslateY(getTranslateY() + speed * ky);
   }
 
   /**
-   *
+   * move brick after check of collisions
    */
   public void move() {
     checkCollision();
@@ -322,7 +322,7 @@
   }
 
   /**
-   *
+   * reset flags before start new game
    */
   public void setFlagsInFalse() {
     leftCollision = false;
diff --git a/src/sample/Bot.java b/src/sample/Bot.java
index 54a2fa0..8e9a11b 100644
--- a/src/sample/Bot.java
+++ b/src/sample/Bot.java
@@ -1,7 +1,9 @@
 package sample;
 
+import java.util.Random;
+
 /**
- *
+ * program can play without player
  */
 public class Bot {
   final int timeOfMoving = 2000;
@@ -25,24 +27,29 @@
    * @return
    */
   public char execute() {
-    if (time == timeOfMoving * 2) {
-      time = 0;
-    }
-    time++;
-    if (time < timeOfMoving) {
-      if (player.getTranslateX() + player.getWidth() / 2
-          < ball.getTranslateX() + ball.getWidth()) {
-        return 'r';
+    Random toMove = new Random();
+    if (toMove.nextBoolean() && toMove.nextBoolean() && toMove.nextBoolean()) {
+      if (time == timeOfMoving * 2) {
+        time = 0;
+      }
+      time++;
+      if (time < timeOfMoving) {
+        if (player.getTranslateX() + player.getWidth() / 2
+            < ball.getTranslateX() + ball.getWidth()) {
+          return 'r';
+        } else {
+          return 'l';
+        }
       } else {
-        return 'l';
+        if (player.getTranslateX() + player.getWidth() / 2
+            < ball.getTranslateX()) {
+          return 'r';
+        } else {
+          return 'l';
+        }
       }
     } else {
-      if (player.getTranslateX() + player.getWidth() / 2
-          < ball.getTranslateX()) {
-        return 'r';
-      } else {
-        return 'l';
-      }
+      return 'n';
     }
   }
 
@@ -53,9 +60,6 @@
     return on;
   }
 
-  /**
-   *
-   */
   public void switchMode() {
     if (on) {
       on = false;
diff --git a/src/sample/Client.java b/src/sample/Client.java
index 074f648..4efba36 100644
--- a/src/sample/Client.java
+++ b/src/sample/Client.java
@@ -9,7 +9,9 @@
 import java.util.ArrayList;
 import java.util.HashSet;
 
-
+/**
+ * responsible for graphics and handlers in game
+ */
 public class Client extends Thread implements Constants {
   Pane gameRoot;
   Scene scene;
@@ -81,9 +83,6 @@
     this.bottom = bottom;
   }
 
-  /**
-   *
-   */
   private void prepareActionHandlers() {
     lastKey = new HashSet<>();
     direction = 'n';
@@ -102,9 +101,7 @@
           server.bot.switchMode();
           break;
         case "ESCAPE":
-          server.working = false;
           game.exit();
-          this.working = false;
       }
       lastKey.add(event.getCode().toString());
     });
@@ -125,7 +122,7 @@
     return direction;
   }
 
-  public String getReplayFile(){
+  public String getReplayFile() {
     return game.getReplayFile();
   }
 }
diff --git a/src/sample/Constants.java b/src/sample/Constants.java
index f2a766a..f41fdee 100644
--- a/src/sample/Constants.java
+++ b/src/sample/Constants.java
@@ -1,7 +1,7 @@
 package sample;
 
 /**
- *
+ * storage of constants
  */
 interface Constants {
   int SCENE_WIDTH = 640;
@@ -19,6 +19,7 @@
   char HARD_MODE = 'h';
   char REPLAY_MODE = 'r';
   int ITER_COUNT = 10000;
+  int NOTES_ON_SCREEN = 19;
   int PLAYER_WIDTH_EASY = 280;
   int PLAYER_WIDTH_MEDIUM = 200;
   int PLAYER_WIDTH_HARD = 200;
@@ -43,5 +44,5 @@
   int STATISTICS_LABEL_WIDTH = 320;
   String[] TOP_LABEL_CONTENT = {"REPLAY", "MODE", "PLAYED", "MOVED LEFT"
       , "MOVED RIGHT"};
-  String RESOURSE_FOLDER = "Resource\\";
+  String RESOURCE_FOLDER = "Resource\\";
 }
diff --git a/src/sample/Game.java b/src/sample/Game.java
index 9719882..721a558 100644
--- a/src/sample/Game.java
+++ b/src/sample/Game.java
@@ -10,6 +10,9 @@
 import java.io.File;
 import java.util.ArrayList;
 
+/**
+ * generate new window and make client and server sides
+ */
 public class Game extends Application implements Constants {
   Pane menuRoot;
   char gameMode;
@@ -17,6 +20,8 @@
   Scene scene;
   Client client;
   String replayFile;
+  int currentIter;
+  String[] fileNames;
   ArrayList<ReplayInfo> replays;
 
   public Game(char gameMode) {
@@ -44,21 +49,34 @@
     scene.getStylesheets().add(Game.class.getResource("style.css")
         .toExternalForm());
     gameStage.setScene(scene);
+    gameStage.setOnCloseRequest(e -> {
+      if (client != null) {
+        client.server.working = false;
+        client.working = false;
+      }
+    });
     gameStage.show();
   }
 
-  private void showReplayMenu() {
-    menuRoot = new Pane();
-    menuRoot.setPrefSize(SCENE_WIDTH, SCENE_HEIGHT);
-    File folder = new File(RESOURSE_FOLDER);
-    String[] fileNames = folder.list();
-    if(fileNames == null) {
-      return;
-    }
+  void makeReplayInfo() {
+    replays.clear();
     for (int i = 0; i < fileNames.length; i++) {
       ReplayInfo replayInfo = new ReplayInfo(fileNames[i]);
       replays.add(replayInfo);
     }
+  }
+
+  private void showReplayMenu() {
+    currentIter = 0;
+    menuRoot = new Pane();
+    menuRoot.setPrefSize(SCENE_WIDTH, SCENE_HEIGHT);
+    File folder = new File(RESOURCE_FOLDER);
+    fileNames = folder.list();
+    if (fileNames == null) {
+      return;
+    }
+
+    makeReplayInfo();
 
     GridPane gridPane = new GridPane();
     gridPane.setLayoutX(GRID_INDENTS);
@@ -72,9 +90,9 @@
 
     gridPane.setOnMouseClicked(e -> {
       int fileNumber = ((int) e.getY()) / GRID_LABEL_HEIGHT - 1;
-      if (fileNumber != -1 && fileNumber < fileNames.length) {
+      if (fileNumber != -1 && fileNumber < NOTES_ON_SCREEN) {
         menuRoot.getChildren().remove(gridPane);
-        replayFile = RESOURSE_FOLDER + replays.get(fileNumber).getReplayName();
+        replayFile = RESOURCE_FOLDER + replays.get(fileNumber).getReplayName();
         startGame();
       } else if (fileNumber == -1) {
         ReplayInfo.sortBy = (int) e.getX() * 5 / (SCENE_WIDTH -
@@ -84,10 +102,29 @@
       }
     });
     scene.setOnKeyPressed(event -> {
-      if (event.getCode().toString() == "ESCAPE") {
-        gameStage.close();
-      } else if(event.getCode().toString() == "T") {
-        sortTest();
+      switch (event.getCode().toString()) {
+        case "ESCAPE": {
+          exit();
+          break;
+        }
+        case "T": {
+          sortTest();
+          break;
+        }
+        case "UP": {
+          if (currentIter != 0) {
+            currentIter -= NOTES_ON_SCREEN;
+            addLabels(gridPane);
+          }
+          break;
+        }
+        case "DOWN": {
+          if (currentIter < replays.size()) {
+            currentIter += NOTES_ON_SCREEN;
+            addLabels(gridPane);
+          }
+          break;
+        }
       }
     });
     gameStage.setScene(scene);
@@ -98,7 +135,7 @@
     return replayFile;
   }
 
-  public void addTopLabels(GridPane gridPane){
+  public void addTopLabels(GridPane gridPane) {
     for (int i = 0; i < 5; i++) {
       Label topLabel = new Label();
       topLabel.setText(TOP_LABEL_CONTENT[i]);
@@ -108,7 +145,7 @@
     }
   }
 
-  public void addNameLabel(GridPane gridPane, int i){
+  public void addNameLabel(GridPane gridPane, int i) {
     Label replayNameLabel = new Label();
     replayNameLabel.setText(replays.get(i).getReplayName());
     replayNameLabel.setPrefWidth((SCENE_WIDTH - GRID_INDENTS * 2) / 5);
@@ -116,7 +153,7 @@
     gridPane.add(replayNameLabel, 0, i + 1);
   }
 
-  public void addModeLabel(GridPane gridPane, int i){
+  public void addModeLabel(GridPane gridPane, int i) {
     Label replayModeLabel = new Label();
     replayModeLabel.setText(replays.get(i).getReplayMode());
     replayModeLabel.setPrefWidth((SCENE_WIDTH - GRID_INDENTS * 2) / 5);
@@ -124,7 +161,7 @@
     gridPane.add(replayModeLabel, 1, i + 1);
   }
 
-  public void addTimeLabel(GridPane gridPane, int i){
+  public void addTimeLabel(GridPane gridPane, int i) {
     Label gameTimeLabel = new Label();
     gameTimeLabel.setText(Integer.toString(replays.get(i).getGameTime()));
     gameTimeLabel.setPrefWidth((SCENE_WIDTH - GRID_INDENTS * 2) / 5);
@@ -132,7 +169,7 @@
     gridPane.add(gameTimeLabel, 2, i + 1);
   }
 
-  public void addLeftMovingTimeLabel(GridPane gridPane, int i){
+  public void addLeftMovingTimeLabel(GridPane gridPane, int i) {
     Label leftMovingTimeLabel = new Label();
     leftMovingTimeLabel.setText(Integer.toString(replays.get(i)
         .getLeftMovingTime()));
@@ -141,7 +178,7 @@
     gridPane.add(leftMovingTimeLabel, 3, i + 1);
   }
 
-  public void addRightMovingTimeLabel(GridPane gridPane, int i){
+  public void addRightMovingTimeLabel(GridPane gridPane, int i) {
     Label rightMovingTimeLabel = new Label();
     rightMovingTimeLabel.setText(Integer.toString(replays.get(i)
         .getRightMovingTime()));
@@ -154,7 +191,7 @@
   public void addLabels(GridPane gridPane) {
     gridPane.getChildren().clear();
     addTopLabels(gridPane);
-    for (int i = 0; i < replays.size(); i++) {
+    for (int i = currentIter; i < currentIter + NOTES_ON_SCREEN && i < replays.size(); i++) {
       addNameLabel(gridPane, i);
       addModeLabel(gridPane, i);
       addTimeLabel(gridPane, i);
@@ -169,29 +206,30 @@
     long traceTime;
     Algorithm algorithm = new Algorithm();
     JavaSort javaSort = new JavaSort();
-    int [] array = new int[replays.size()];
-    for(int i = 0; i < replays.size(); i++){
-      array[i] = replays.get(i).getGameTime();
+    int[] array = new int[replays.size()*100];
+    for (int j = 0; j < 100; j++){
+      for (int i = 0; i < replays.size(); i++) {
+        array[j * replays.size() + i] = replays.get(i).getGameTime();
+      }
     }
     System.out.println("Time of sorting:");
     start = System.nanoTime();
-    for(int i = 0; i < ITER_COUNT; i++){
-      algorithm.sort(array);
-    }
+    algorithm.sort(array);
     end = System.nanoTime();
-    traceTime = end-start;
+    traceTime = end - start;
     System.out.println("Scala: " + traceTime);
-
     start = System.nanoTime();
-    for(int i = 0; i < ITER_COUNT; i++) {
-      javaSort.sort(array);
-    }
+    javaSort.sort(array);
     end = System.nanoTime();
-    traceTime = end-start;
+    traceTime = end - start;
     System.out.println("Java:  " + traceTime);
   }
 
   public void exit() {
+    if (client != null) {
+      client.server.working = false;
+      client.working = false;
+    }
     gameStage.close();
   }
 }
diff --git a/src/sample/JavaSort.java b/src/sample/JavaSort.java
index 00302aa..8ddeac4 100644
--- a/src/sample/JavaSort.java
+++ b/src/sample/JavaSort.java
@@ -1,10 +1,26 @@
 package sample;
 
+/**
+ * sorting int java
+ */
 public class JavaSort {
+
+  /**
+   * interface for quicksort
+   *
+   * @param xs
+   */
   void sort(int[] xs) {
     sort(xs, 0, xs.length - 1);
   }
 
+  /**
+   * quicksort algorithm
+   *
+   * @param xs
+   * @param l
+   * @param r
+   */
   void sort(int[] xs, int l, int r) {
     int pivot = xs[(l + r) / 2];
     int a = l;
@@ -26,6 +42,13 @@
     if (b < r) sort(xs, a, r);
   }
 
+  /**
+   * swaps ints in array
+   *
+   * @param arr
+   * @param i
+   * @param j
+   */
   void swap(int[] arr, int i, int j) {
     int t = arr[i];
     arr[i] = arr[j];
diff --git a/src/sample/Player.java b/src/sample/Player.java
index db28268..764237f 100644
--- a/src/sample/Player.java
+++ b/src/sample/Player.java
@@ -4,9 +4,9 @@
 import javafx.scene.shape.Rectangle;
 
 /**
- *
+ * Platform of player, can move left and right
  */
-public class Player extends SimpleObject implements MoveConstants {
+public class Player extends SimpleObject {
   double speed;
   double leftBorder;
   double rightBorder;
@@ -32,20 +32,12 @@
     this.speed = speed;
   }
 
-  /**
-   *
-   *
-   */
   public void moveLeft() {
     if (this.getTranslateX() > leftBorder) {
       setTranslateX(this.getTranslateX() - speed);
     }
   }
 
-  /**
-   *
-   *
-   */
   public void moveRight() {
     if (this.getTranslateX() + this.getWidth() < rightBorder) {
       setTranslateX(this.getTranslateX() + speed);
diff --git a/src/sample/ReplayInfo.java b/src/sample/ReplayInfo.java
index eb0cb81..c116fda 100644
--- a/src/sample/ReplayInfo.java
+++ b/src/sample/ReplayInfo.java
@@ -1,5 +1,8 @@
 package sample;
 
+/**
+ * class store information about replays
+ */
 public class ReplayInfo implements Constants, Comparable<ReplayInfo> {
   String replayName;
   String replay;
@@ -9,9 +12,14 @@
   int gameTime;
   static int sortBy;
 
+  /**
+   * constructor
+   *
+   * @param replayName
+   */
   ReplayInfo(String replayName) {
     this.replayName = replayName;
-    replay = Serializer.loadReplay(RESOURSE_FOLDER + replayName);
+    replay = Serializer.loadReplay(RESOURCE_FOLDER + replayName);
     switch (replay.toCharArray()[0]) {
       case 'e':
         replayMode = "EASY";
@@ -32,6 +40,12 @@
     rightMovingTime = algorithm.countRightMove(replay.toCharArray());
   }
 
+  /**
+   * realize comparable interface
+   *
+   * @param o
+   * @return
+   */
   @Override
   public int compareTo(ReplayInfo o) {
     int result = 0;
@@ -56,22 +70,47 @@
     return result;
   }
 
+  /**
+   * getter for right moving time
+   *
+   * @return
+   */
   public int getRightMovingTime() {
     return rightMovingTime;
   }
 
+  /**
+   * getter for replay mode
+   *
+   * @return
+   */
   public String getReplayMode() {
     return replayMode;
   }
 
+  /**
+   * getter for left moving time
+   *
+   * @return
+   */
   public int getLeftMovingTime() {
     return leftMovingTime;
   }
 
+  /**
+   * getter for game time
+   *
+   * @return
+   */
   public int getGameTime() {
     return gameTime;
   }
 
+  /**
+   * getter for replay name
+   *
+   * @return
+   */
   public String getReplayName() {
     return replayName;
   }
diff --git a/src/sample/Serializer.java b/src/sample/Serializer.java
index 5e967de..59bc6a8 100644
--- a/src/sample/Serializer.java
+++ b/src/sample/Serializer.java
@@ -4,14 +4,16 @@
 import java.util.Date;
 
 /**
- *
+ * save and load replays from Resource folder
  */
 public class Serializer implements Constants {
   /**
+   * save replay with unique name
+   *
    * @param string
    */
   public static void saveReplay(String string) {
-    File folder = new File(RESOURSE_FOLDER);
+    File folder = new File(RESOURCE_FOLDER);
     String[] fileNames = folder.list();
     int max = 0;
     if (fileNames != null) {
@@ -25,12 +27,11 @@
         max++;
       } catch (NumberFormatException e) {
       }
-    }
-    else {
+    } else {
       max = 1;
     }
 
-    String fileName = RESOURSE_FOLDER + Integer.toString(max);
+    String fileName = RESOURCE_FOLDER + Integer.toString(max);
     File file = new File(fileName);
     try (FileWriter writer = new FileWriter(file, false)) {
       writer.write(string);
@@ -41,6 +42,8 @@
   }
 
   /**
+   * load replay by name
+   *
    * @param fileName
    * @return
    */
diff --git a/src/sample/Server.java b/src/sample/Server.java
index 606f097..e6c9b3e 100644
--- a/src/sample/Server.java
+++ b/src/sample/Server.java
@@ -5,7 +5,10 @@
 
 import java.util.ArrayList;
 
-public class Server extends Thread implements Constants, MoveConstants {
+/**
+ * responsible for objects of game
+ */
+public class Server extends Thread implements Constants {
   Player player;
   Ball ball;
   ArrayList<SimpleObject> bricks;
@@ -170,7 +173,9 @@
     if (replayNow) {
       replayIterator = 1;
     } else {
-      Serializer.saveReplay(replay);
+      for(int i = 0; i < 1000; i++) {
+        Serializer.saveReplay(replay);
+      }
       replay = "" + gameMode;
     }
     client.resetBricks();
diff --git a/src/sample/SimpleObject.java b/src/sample/SimpleObject.java
index 35d6a8f..44b9f88 100644
--- a/src/sample/SimpleObject.java
+++ b/src/sample/SimpleObject.java
@@ -5,7 +5,7 @@
 import javafx.scene.shape.Rectangle;
 
 /**
- *
+ * the simplest graphic object in game such as wall
  */
 public class SimpleObject extends Pane {
   Rectangle rect;
diff --git a/src/sample/Statistics.java b/src/sample/Statistics.java
index f0d4c10..c311089 100644
--- a/src/sample/Statistics.java
+++ b/src/sample/Statistics.java
@@ -12,6 +12,9 @@
 import java.io.File;
 import java.util.ArrayList;
 
+/**
+ * new window contain statistics of all played games
+ */
 public class Statistics extends Application implements Constants {
   Stage stage;
   Pane root;
@@ -21,7 +24,7 @@
   int allTimeMovedLeft;
   int allTimeNotMoved;
 
-  public Statistics(){
+  public Statistics() {
     replays = new ArrayList<>();
     allTimePlayed = 0;
     allTimeMovedRight = 0;
@@ -31,10 +34,12 @@
     start(stage);
   }
 
-  void initStatistics(){
-    File folder = new File(RESOURSE_FOLDER);
+  void initStatistics() {
+
+    File folder = new File(RESOURCE_FOLDER);
     String[] fileNames = folder.list();
-    if(fileNames == null) {
+
+    if (fileNames == null) {
       return;
     }
     for (int i = 0; i < fileNames.length; i++) {
@@ -54,13 +59,14 @@
   @Override
   public void start(Stage stage) {
     initStatistics();
-    Button [] buttons = new Button[4];
-    for(int i = 0; i < 4; i++){
+    Button[] buttons = new Button[4];
+    for (int i = 0; i < 4; i++) {
       buttons[i] = new Button();
-      buttons[i].setTranslateY(STATISTICS_LABEL_INDENTS+i*(STATISTICS_LABEL_INDENTS+STATISTICS_LABEL_HEIGHT));
+      buttons[i].setTranslateY(STATISTICS_LABEL_INDENTS + i
+          * (STATISTICS_LABEL_INDENTS + STATISTICS_LABEL_HEIGHT));
       buttons[i].setPrefWidth(STATISTICS_LABEL_WIDTH);
       buttons[i].setPrefHeight(STATISTICS_LABEL_HEIGHT);
-      buttons[i].setTranslateX(SCENE_WIDTH/2 - STATISTICS_LABEL_WIDTH/2);
+      buttons[i].setTranslateX(SCENE_WIDTH / 2 - STATISTICS_LABEL_WIDTH / 2);
     }
     buttons[0].setText("Time played: " + allTimePlayed);
     buttons[1].setText("Time moved right: " + allTimeMovedRight);