adding comments

added all the necessary comments to describe the functions