Added comments to easy understand the code