added more comments to code