added some comments to explain what needs to be done