Made some refactoring.
The documentation has been written
Fixed comments