Added some comments on the code