Added commentaries to the code