Adding documentation to the code and removing unused areas

Adding documentation to the code and removing unused areas