Added documentation to the code

Documentation can be found in main.js